Bar.java 823 B

123456789101112131415161718192021222324252627282930
  1. package main.java.com.lotkavolterra;
  2. public class Bar extends Structs {
  3. float x; // top left corner x position
  4. float y; // top left corner y position
  5. float w; // width of button
  6. float h; // height of button
  7. float my_fill; // Fill the box till
  8. Bar( float xpos, float ypos, float widthB, float heightB) {
  9. x = xpos;
  10. y = ypos;
  11. w = widthB;
  12. h = heightB;
  13. my_fill=x;
  14. }
  15. double get_value() {
  16. return my_fill/w;
  17. }
  18. boolean MouseIsOver( float mouseX, float mouseY) {
  19. if (mouseX > x && mouseX < (x + w) && mouseY > y && mouseY < (y + h)) {
  20. my_fill=mouseX - x;
  21. return true;
  22. }
  23. return false;
  24. }
  25. }