file: StyleClassedTextArea.aus

class: StyleClassedTextArea

[99:7] extends: Region

StyleClassedTextArea wraps the RichTextFX StyleClassedTextArea control, a multi-line text area that styles character ranges by assigning CSS class names rather than inline CSS strings. You define appearance rules in a separate CSS file and attach it with getStylesheets(), then apply named classes to ranges with setStyleClass() or setStyleClasses(). This approach separates visual rules from code and is the preferred pattern for syntax highlighting. The class supports the full text-editing lifecycle: content manipulation, caret and selection management, undo/redo, clipboard operations, scroll control, and event callbacks.

CSS Style Classes

Style Class Applied To Description
.styled-text-area The area root Default style class applied to all RichTextFX areas.
.content Inner content region Wraps the scrollable text content.
.paragraph-box Each paragraph row Container for one line or paragraph of text.
.paragraph-text Text flow in a paragraph Holds the individual text segments.
.caret The text insertion caret A thin blinking line indicating the insert position.
.selection Selected text highlight Drawn behind selected character ranges.

CSS Properties -- StyledTextArea (.styled-text-area)

Property Values Default Description
-fx-font <font> null (inherits) Font applied to the entire area when no per-character font is set.
-fx-cursor <cursor> text Mouse cursor shape. RichTextFX defaults this to the text cursor.
-fx-background-color <paint> white Background fill of the content area.
-fx-padding <size> or <t> <r> <b> <l> 0 Interior padding between the border and the text.

CSS Properties -- Caret (.caret)

Property Values Default Description
-rtfx-blink-rate <duration> 500ms Blink period of the caret. Set to 0ms to disable blinking.
-fx-stroke <paint> black Color of the caret line.
-fx-stroke-width <number> 1 Width of the caret line in pixels.

CSS Properties -- Selection (.selection)

Property Values Default Description
-fx-fill <paint> dodgerblue Fill color of the selection highlight rectangle.

CSS Properties -- Region (inherited)

Background fills

Property Values Default Description
-fx-background-color <paint> [, <paint>]* white One or more paint values for background fill layers, rendered back to front.
-fx-background-insets <size> or <t> <r> <b> <l> [, ...]* 0 Insets from the region edges for each background fill layer.
-fx-background-radius <size> [/ <size>]* [, ...]* 0 Corner radii for each background fill layer.

Stroked borders

Property Values Default Description
-fx-border-color <paint> or <t> <r> <b> <l> [, ...]* null Paint colors for the border stroke layers.
-fx-border-insets <size> or <t> <r> <b> <l> [, ...]* null Insets from region edges for each border layer.
-fx-border-radius <size> [, ...]* null Corner radii for border stroke layers.
-fx-border-style <border-style> [, ...]* null Border line style (solid, dotted, dashed) plus line cap/join options per layer.
-fx-border-width <size> or <t> <r> <b> <l> [, ...]* null Thickness of each border stroke layer, per side.

Other Region properties

Property Values Default Description
-fx-padding <size> or <t> <r> <b> <l> 0 Interior padding between the region border and its content.
-fx-min-width <size> -1 Minimum width. -1 uses the computed minimum.
-fx-pref-width <size> -1 Preferred width. -1 uses the computed preferred.
-fx-max-width <size> -1 Maximum width. -1 uses the computed maximum.
-fx-min-height <size> -1 Minimum height. -1 uses the computed minimum.
-fx-pref-height <size> -1 Preferred height. -1 uses the computed preferred.
-fx-max-height <size> -1 Maximum height. -1 uses the computed maximum.

CSS Properties -- Node (inherited)

Property Values Default Description
-fx-blend-mode add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over null Blend mode used when compositing this node with nodes beneath it.
-fx-effect <effect> null A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node.
-fx-opacity <number> [0.0 - 1.0] 1 Opacity of the node. 0 is fully transparent, 1 is fully opaque.
-fx-rotate <number> 0 Rotation angle in degrees applied around the node's center point.
-fx-scale-x <number> 1 Scale factor along the X axis about the node's center.
-fx-scale-y <number> 1 Scale factor along the Y axis about the node's center.
-fx-translate-x <number> 0 Translation offset along the X axis in pixels.
-fx-translate-y <number> 0 Translation offset along the Y axis in pixels.
visibility visible | hidden | collapse | inherit visible Controls whether the node is rendered and participates in layout.
-fx-managed true | false true When false, the parent layout does not manage this node's position or size.

Methods