RichTextArea (JavaFX incubator control) — the
selection-, caret- and accessibility-capable alternative to FxRenderer.
Inline content maps to styled segments (StyleAttributeMap); <mark>/background runs map
to native highlights; links carry the custom HREF attribute and are resolved on click via
RichTextArea#getTextPosition. Tables and horizontal rules are embedded as node paragraphs
rendered by FxRenderer; images are embedded as inline nodes. Known interim gaps (tracked
upstream, see the project's issue #2): sub-/superscript lose their baseline shift and
numeric font weights collapse to bold/normal.
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final double | |
| public static final StyleAttribute | HREF
Character attribute carrying a link target; resolved on mouse click. |
| private double | indent
left indent (in px) applied to paragraphs, e.g. inside |
| private static final Color | LINK_COLOR
Fallback link color; matches FxRenderer's un-themed link fill. |
| private final SimpleViewOnlyStyledModel | |
| private final HtmlRenderOptions | |
| private boolean | paragraphOccupied
whether the model's last paragraph is occupied (text, node, or a preserved blank line) |
| private int | paragraphOffset
characters already added to the paragraph currently being built |
| private @Nullable String | pendingMarker
marker text (e.g. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private StyleAttributeMap | |
| public static StyledTextModel | Returns: a read-only model forRichTextArea#setModelthe blocks to render, typically from blocks, HtmlRenderOptions HtmlToNode.parse(...)rendering options options)Builds the styled document model. |
| public static void | configure(RichTextArea area, HtmlRenderOptions options)
Applies the standard preview configuration (read-only, wrapping, link clicks) to |
| private void | embed(List<Block> blocks)
Embeds blocks as a self-contained node paragraph rendered by |
| public static @Nullable String | hrefAt(StyledTextModel model, TextPos position)
Returns the link target at |
| private void | |
| public static RichTextArea | Returns: the configured controlthe blocks to render blocks, HtmlRenderOptions rendering options options)Renders the blocks into a ready-to-use, read-only |
| private void | |
| private void | startParagraph(double spaceAbove)
Ends the previous paragraph (if occupied) and applies attributes/markers to the new one. |
| baseFamily | back to summary |
|---|---|
| private final String baseFamily | |
| baseSize | back to summary |
|---|---|
| private final double baseSize | |
| HREF | back to summary |
|---|---|
| public static final StyleAttribute<String> HREF Character attribute carrying a link target; resolved on mouse click. | |
| indent | back to summary |
|---|---|
| private double indent left indent (in px) applied to paragraphs, e.g. inside | |
| LINK_COLOR | back to summary |
|---|---|
| private static final Color LINK_COLOR Fallback link color; matches FxRenderer's un-themed link fill. | |
| model | back to summary |
|---|---|
| private final SimpleViewOnlyStyledModel model | |
| options | back to summary |
|---|---|
| private final HtmlRenderOptions options | |
| paragraphOccupied | back to summary |
|---|---|
| private boolean paragraphOccupied whether the model's last paragraph is occupied (text, node, or a preserved blank line) | |
| paragraphOffset | back to summary |
|---|---|
| private int paragraphOffset characters already added to the paragraph currently being built | |
| pendingMarker | back to summary |
|---|---|
| private @Nullable String pendingMarker marker text (e.g. | |
| RichTextRenderer | back to summary |
|---|---|
| private RichTextRenderer(HtmlRenderOptions options) | |
| appendBlocks | back to summary |
|---|---|
| private void appendBlocks(List<Block> blocks) | |
| appendRun | back to summary |
|---|---|
| private void appendRun(String text, InlineStyle style) | |
| attributes | back to summary |
|---|---|
| private StyleAttributeMap attributes(InlineStyle style, double sizeFactor) | |
| buildModel | back to summary |
|---|---|
| public static StyledTextModel buildModel(List<Block> blocks, HtmlRenderOptions options) Builds the styled document model. Does not require the JavaFX toolkit.
| |
| configure | back to summary |
|---|---|
| public static void configure(RichTextArea area, HtmlRenderOptions options) Applies the standard preview configuration (read-only, wrapping, link clicks) to | |
| embed | back to summary |
|---|---|
| private void embed(List<Block> blocks) Embeds blocks as a self-contained node paragraph rendered by | |
| hrefAt | back to summary |
|---|---|
| public static @Nullable String hrefAt(StyledTextModel model, TextPos position) Returns the link target at Node segments (embedded images, tables) carry no character attributes, so the model
returns a null attribute map there — only text runs can hold an | |
| paragraph | back to summary |
|---|---|
| private void paragraph(List<Inline> inlines, double scale, int minWeight, double spaceAbove) | |
| render | back to summary |
|---|---|
| public static RichTextArea render(List<Block> blocks, HtmlRenderOptions options) Renders the blocks into a ready-to-use, read-only
| |
| separateParagraph | back to summary |
|---|---|
| private void separateParagraph() | |
| startParagraph | back to summary |
|---|---|
| private void startParagraph(double spaceAbove) Ends the previous paragraph (if occupied) and applies attributes/markers to the new one. | |