slider.adoc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. = slider
  2. :revnumber: 2.0
  3. :revdate: 2020/07/25
  4. == Slider Class
  5. The Slider class provides the same 3 common constructors shown in the xref:gui/tonegodgui/quickstart.adoc[Quick Start Guide] with the addition of two extra parameters.
  6. * The orientation of the Slider
  7. * A boolean flag telling the control whether or not the track should "`surround`" the thumb.
  8. The additional parameter are appended to the existing parameter list for all 3 constructors, like so:
  9. [source,java]
  10. ----
  11. /**
  12. * Parameters:
  13. * Screen screen
  14. * String UID
  15. * Vector2f position
  16. * Slider.Orientation orientation
  17. * boolean trackSurroundsThumb
  18. */
  19. Slider slider1 = new Slider(
  20. screen,
  21. "SomeID",
  22. new Vector2f(15, 15),
  23. Slider.Orientation.HORIZONTAL,
  24. true
  25. );
  26. ----
  27. === Abstract Event Methods:
  28. [source,java]
  29. ----
  30. public void onChange(int selectedIndex, String value);
  31. ----
  32. === Methods specific to the Slider class:
  33. [source,java]
  34. ----
  35. // Adding/removing step values
  36. slider1.addStepValue(String value);
  37. slider1.removeStepValue(String value);
  38. // Selected values
  39. slider1.getSelectedIndex();
  40. ----
  41. You can set the select Sliders position and selected value using:
  42. [source,java]
  43. ----
  44. slider1.setSelectedIndex(int selectedIndex)
  45. ----