[97:7] extends: FxObj
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.
| 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. |
| 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. |
| 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. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-fill |
<paint> |
dodgerblue |
Fill color of the selection highlight rectangle. |
| 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. |
| 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. |
| 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. |
| 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. |
StyleClassedTextArea (Text = null)
Creates a new StyleClassedTextArea with optional initial text.
Text is a string with the initial text content, or null for an empty area.getText ()
Returns the full plain text content of the area, without any style information.
A string with all characters in the document.getTextRange (int Start, int End)
Returns the plain text in the specified character range.
Start is an int with the inclusive start index.End is an int with the exclusive end index.A string with the text in the range [Start, End).setText (string Text)
Replaces the entire content of the area with the given text.
Text is a string to set as the new content; pass an empty string to clear.this object for chainingappendText (string Text)
Appends text to the end of the current content.
Text is a string to append.this object for chaininginsertText (int Pos, string Text)
Inserts text at the given character index without removing any existing text.
Pos is an int with the zero-based index at which to insert.Text is a string to insert.this object for chainingdeleteText (int Start, int End)
Deletes the characters in the range [Start, End) from the document.
Start is an int with the inclusive start index.End is an int with the exclusive end index.this object for chainingreplaceText (int Start, int End, string Text)
Replaces the characters in the range [Start, End) with the given text.
Start is an int with the inclusive start index.End is an int with the exclusive end index.Text is a string to insert in place of the deleted range.this object for chaininggetLength ()
Returns the total number of characters in the area.
An int with the document length.getParagraphCount ()
Returns the number of paragraphs (lines when word wrap is off) in the area.
An int with the paragraph count.getParagraph (int ParIndex)
Returns the plain text of the paragraph at the given index.
ParIndex is an int with the zero-based paragraph index.A string with the plain text of that paragraph.getCaretPosition ()
Returns the current caret position as a zero-based character index.
An int with the caret position.getSelectedText ()
Returns the currently selected plain text, or an empty string when nothing is selected.
A string with the selected text.getSelection ()
Returns the current selection as a Java IndexRange object accessible via AJI. Call .invoke("getStart") and .invoke("getEnd") on the returned object to read the range.
An AussomJavaObject wrapping the IndexRange of the current selection.selectRange (int Start, int End)
Sets the selection to the given range and moves the caret to End.
Start is an int with the inclusive start of the selection.End is an int with the exclusive end of the selection.this object for chainingselectAll ()
Selects all text in the area.
this object for chainingdeselect ()
Clears the current selection without changing the caret position.
this object for chainingmoveTo (int Pos)
Moves the caret to the given position without selecting any text.
Pos is an int with the zero-based target character index.this object for chainingmoveToStart ()
Moves the caret to position 0, the beginning of the document.
this object for chainingmoveToEnd ()
Moves the caret to the end of the document.
this object for chainingundo ()
Undoes the last edit operation if undo history is available.
this object for chainingredo ()
Redoes the last undone operation if redo history is available.
this object for chainingcut ()
Cuts the selected text to the system clipboard and removes it from the area.
this object for chainingcopyToClipboard ()
Copies the selected text to the system clipboard without modifying the area.
this object for chainingpaste ()
Pastes text from the system clipboard at the current caret position.
this object for chainingclear ()
Clears all text from the area, leaving an empty document.
this object for chainingsetWrapText (bool Wrap)
Sets whether text wraps at the right edge of the area instead of scrolling horizontally.
Wrap is a bool with true to enable word wrap.this object for chainingsetEditable (bool Editable)
Sets whether the user can edit the area content.
Editable is a bool with false to make the area read-only.this object for chainingsetPrefSize (double W, double H)
Sets the preferred width and height of the area in pixels.
W is a double with the preferred width.H is a double with the preferred height.this object for chainingsetId (string Id)
Sets the CSS ID of the area node for scene graph lookup and CSS targeting.
Id is a string with the ID, used with "#id" in CSS selectors and testfx.lookup.this object for chainingsetStyle (string Style)
Applies an inline CSS style string to the entire area node. This sets the JavaFX node's own style, not the per-character RichTextFX style.
Style is a string with one or more CSS property declarations (e.g., "-fx-background-color: black;").this object for chaininggetStylesheets ()
Returns the area's stylesheet list as an AussomJavaObject wrapping an ObservableList
. Add CSS file URIs to this list to style the area from an external stylesheet. Example: area.getStylesheets().invoke("add", "path/to/highlight.css")
An AussomJavaObject wrapping the stylesheet ObservableList.setLineNumbers (bool Show)
Shows or hides a line number gutter to the left of each paragraph. When Show is true, uses LineNumberFactory to generate the gutter nodes.
Show is a bool with true to display line numbers.this object for chainingsetContextMenu (object MenuObj)
Attaches a ContextMenu to the area, replacing the built-in right-click menu.
MenuObj is a ContextMenu object to attach.this object for chainingsetMouseOverTextDelay (int Millis)
Sets the delay in milliseconds before a mouse-over-text event fires. Use this in combination with onMouseOverText to show hover tooltips.
Millis is an int with the hover delay in milliseconds.this object for chainingscrollToPixel (double X, double Y)
Scrolls the viewport to the given pixel offsets.
X is a double with the horizontal pixel offset.Y is a double with the vertical pixel offset.this object for chainingscrollYBy (double Delta)
Scrolls the viewport vertically by the given pixel delta. Positive values scroll down; negative values scroll up.
Delta is a double with the number of pixels to scroll.this object for chainingscrollXBy (double Delta)
Scrolls the viewport horizontally by the given pixel delta. Positive values scroll right; negative values scroll left.
Delta is a double with the number of pixels to scroll.this object for chainingscrollToBottom ()
Scrolls the viewport to the bottom of the content.
this object for chainingonChange (callback OnChange)
Registers a callback invoked whenever the plain text content changes. The callback receives a PlainTextChange Java object; call .invoke("getInserted"), .invoke("getRemoved"), and .invoke("getPosition") to read change details.
OnChange is a callback with signature (Change).this object for chainingonCaretChange (callback OnChange)
Registers a callback invoked whenever the caret position changes. The callback receives (ObservableValue, oldPos, newPos) matching the ChangeListener signature.
OnChange is a callback with signature (ObservableValue, OldPos, NewPos).this object for chainingonSelectionChange (callback OnChange)
Registers a callback invoked whenever the selection range changes. The callback receives (ObservableValue, oldRange, newRange) matching the ChangeListener signature. Call .invoke("getStart") and .invoke("getEnd") on newRange to read the new selection bounds.
OnChange is a callback with signature (ObservableValue, OldRange, NewRange).this object for chainingonMouseOverText (callback OnHover)
Registers a callback invoked when the mouse hovers over text for the delay set by setMouseOverTextDelay. The callback receives a MouseOverTextEvent Java object; call .invoke("getCharacterIndex") to get the index of the character under the cursor.
OnHover is a callback with signature (MouseOverTextEvent).this object for chainingsetStyleClass (int From, int To, string StyleClass)
Assigns a single CSS class name to the character range [From, To). The class must be defined in a stylesheet attached via getStylesheets().
From is an int with the inclusive start index of the range.To is an int with the exclusive end index of the range.StyleClass is a string with the CSS class name to assign.this object for chainingsetStyleClasses (int From, int To, list ClassNames)
Assigns a list of CSS class names to the character range [From, To). All listed classes are applied simultaneously to the range.
From is an int with the inclusive start index of the range.To is an int with the exclusive end index of the range.ClassNames is a list of strings with the CSS class names to assign.this object for chainingsetStyleClassOfParagraph (int ParIndex, string StyleClass)
Assigns a CSS class to the entire paragraph at the given index.
ParIndex is an int with the zero-based paragraph index.StyleClass is a string with the CSS class name to assign.this object for chainingclearStyle (int From, int To)
Removes all style classes from the character range [From, To).
From is an int with the inclusive start index of the range.To is an int with the exclusive end index of the range.this object for chainingclearStyleOfParagraph (int ParIndex)
Removes all style classes from the paragraph at the given index.
ParIndex is an int with the zero-based paragraph index.this object for chainingclearStyles ()
Removes all style classes from the entire document.
this object for chaining