Skip to content
JordanMartinez edited this page Sep 16, 2016 · 12 revisions

Welcome to the RichTextFX wiki!

###Some general useful info:

  • RichTextFX as a Control:
  • The main class used to display rich text areas is StyledTextArea. This class extended Control in the past. However, developers encountered a number of problems in that they needed access to the Skin. So, the Skin was inlined into StyledTextArea. Since the Control-related methods were no longer needed or functioned improperly after the removal, StyledTextArea now extends Region.
  • However, StyledTextArea still adheres to the MVC paradigm.
    • The Model is a StyledDocument.
    • The View (and to some extent, Controller) is StyledTextArea.
    • The Controller (to some extent) is StyledTextAreaBehavior, which already provides most of the behavior one would expect from a TextArea.
  • StyledTextArea's viewport: StyledTextArea only displays the lines that need to be displayed. The benefit of this is that, despite having a StyledDocument with thousands of lines, the area will still display these lines efficiently. The downside is that the area does not always know how tall or wide the actual document is. When the area does not wrap lines and the same font size is used throughout the area, then the scrollX and scrollY values are accurate. However, once one of these two restraints is broken, the area's scrollbars can no longer be set accurately. For more information about this downside, see TomasMikula/Flowless.
  • Updating the Area's Font: To adjust the font used throughout the entire StyledTextArea, update the area's CSS style. The example below changes the font size used throughout the entire area when no other font size is defined:
InlineCssTextArea area = AreaFactory.inlineCssTextArea("Hello");
area.setStyle("-fx-font-size: 30;");