checkbox.adoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. = checkbox
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. :relfileprefix: ../../../
  6. :imagesdir: ../../..
  7. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  8. == CheckBox Class
  9. * CheckBox’s extend the Button class and enable the Toggle setting
  10. * They provide a default label (which is only added if the label text is set).
  11. * They provide the abstract method onChange for executing code when the CheckBox is altered by the user.
  12. Again, the same three options for constructor are available as show in the <<jme3/contributions/tonegodgui/quickstart#,Quick Start Guide>>.
  13. *Constructor 1:*
  14. [source,java]
  15. ----
  16. /** Parameters:
  17. * Screen screen,
  18. * String UID,
  19. * Vector2f position
  20. */
  21. CheckBox cb = new CheckBox(screen, “cb”, new Vector2f(15, 15));
  22. ----
  23. *Constructor 2:*
  24. [source,java]
  25. ----
  26. /** Additional Parameter:
  27. * Vector2f dimensions */
  28. CheckBox cb = new CheckBox(screen, “cb”, new Vector2f(15, 15),
  29. new Vector2f(25, 25)
  30. );
  31. ----
  32. *Constructor 3:*
  33. [source,java]
  34. ----
  35. /** Additional Parameters:
  36. * Vector4f resizeBorders,
  37. * String defaultImg
  38. */
  39. CheckBox cb = new CheckBox(screen, “cb”, new Vector2f(15, 15), new Vector2f(25, 25),
  40. new Vector4f(3,3,3,3),
  41. “tonegod/gui/style/def/Button/checkbox_u_x.png”
  42. );
  43. ----
  44. === Hover State
  45. You can override the default hover state using the following method:
  46. [source,java]
  47. ----
  48. // Override the information used by the hover effect
  49. cb.setButtonHoverInfo(String imagePath, ColorRGBA textHoverColor);
  50. ----
  51. === Pressed State
  52. You can override the default pressed state using the following method:
  53. [source,java]
  54. ----
  55. // Override the information used by the pressed effect
  56. cb.setButtonPressedInfo(String imagePath, ColorRGBA textPressedColor);
  57. ----
  58. === Abstract Event Methods:
  59. [source,java]
  60. ----
  61. public void onChange(boolean isChecked);
  62. ----
  63. === Methods Specific to the CheckBox Class:
  64. [source,java]
  65. ----
  66. cb.setCheckboxText(String text);
  67. cb.getIsChecked();
  68. ----