scrollarea.adoc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. = scrollarea
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. :relfileprefix: ../../../
  6. :imagesdir: ../../..
  7. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  8. == ScrollArea class
  9. Utilizes the standard 3 constructors as shown in the <<jme3/contributions/tonegodgui/quickstart#,Quick Start Guide>> with the addition of a single boolean:
  10. * isTextOnly – appended to the end of the param list for each constructor
  11. The additional parameter is appended to the end of the parameter list for each of the 3 constructors, like so:
  12. [source,java]
  13. ----
  14. /**
  15. * Parameters:
  16. * Screen screen
  17. * String UID
  18. * Vector2f position
  19. * boolean isTextOnly
  20. */
  21. ScrollArea scrollArea = new ScrollArea(
  22. screen,
  23. “SomeID”,
  24. new Vector2f(15, 15),
  25. true
  26. );
  27. ----
  28. [NOTE]
  29. ====
  30. The ScrollArea implements Vertical Scrolling only. Why? Because I was lazy. Eventually I will add Horizontal scrolling as well.
  31. ====
  32. ScrollArea's can be implemented in two ways: Text Only, or an inner element that can contain nested Elements.
  33. . The text only version uses the Element setText() method for adding to the scrollable content.
  34. . The inner Element method uses addScrollableChild() as well as setText() to add scrollable content
  35. When using a scroll area for building Custom Controls, consider the potential uses of the ScrollArea to alleviate unnecessary overhead. If the text only version will suffice… USE IT! No reason to create the extra Element if it will not be used.
  36. === Methods specific to the ScrollArea class:
  37. [source,java]
  38. ----
  39. // Config methods
  40. scrollArea.getIsTextOnly();
  41. scrollArea.setPadding(float padding);
  42. scrollArea.getPadding();
  43. scrollArea.getScrollableHeight();
  44. // Pointer to VScrollBar
  45. scrollArea.getVScrollBar();
  46. //Scrolling methods
  47. scrollArea.scrollYTo(float y);
  48. scrollArea.scrollYBy(float yInc);
  49. scrollArea.scrollToTop();
  50. scrollArea.scrollToBottom();
  51. ----