Button.java 671 B

1234567891011121314151617181920212223242526
  1. package main.java.com.lotkavolterra;
  2. import processing.core.PApplet;
  3. class Button extends PApplet {
  4. String label;
  5. float x; // top left corner x position
  6. float y; // top left corner y position
  7. float w; // width of button
  8. float h; // height of button
  9. Button(String labelB, float xpos, float ypos, float widthB, float heightB) {
  10. label = labelB;
  11. x = xpos;
  12. y = ypos;
  13. w = widthB;
  14. h = heightB;
  15. }
  16. boolean MouseIsOver(float mouseX, float mouseY) {
  17. if (mouseX > x && mouseX < (x + w) && mouseY > y && mouseY < (y + h)) {
  18. return true;
  19. }
  20. return false;
  21. }
  22. }