Slider.java 809 B

12345678910111213141516171819202122232425262728
  1. package main.java.com.lotkavolterra;
  2. public class Slider extends Graphs {
  3. float x; // top left corner x position
  4. float y; // top left corner y position
  5. float w; // width of button
  6. String label;
  7. float w0; // Fill the box till
  8. Slider(String mylabel, float xpos, float ypos, float widthB) {
  9. x = xpos;
  10. y = ypos;
  11. w = widthB;
  12. label = mylabel;
  13. w0=0;
  14. }
  15. float get_speed(){
  16. return w0/w;
  17. }
  18. boolean MouseIsOver( float mouseX, float mouseY) {
  19. if (mouseX > x && mouseX < (x + w) && mouseY > y-PIC_SIZE/2 && mouseY < (y + PIC_SIZE/2)) {
  20. w0=mouseX - x;
  21. return true;
  22. }
  23. return false;
  24. }
  25. }