slider.adoc 1.3 KB

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