TextArea

A multi-line text editor.

See TextField for a single line text editor.

JavaFX's TextArea, stores the document as a simple String, and the caret position as a simple Int. This make editing longish documents very expensive.

So Glok stores the document as an array of lines (each line is a simple String). The caretPosition and anchorPosition are TextPositions, which are composed of a row and column.

The same TextDocument can be shared by more than one TextArea, giving multiple views of the same document. (Changes to one will be seen in the other).

TextArea has been optimised to handle long documents. It has not been optimised to handle extremely long lines.

Theme DSL

"text_area" {

    lineHeight( number )
    prefColumnCount( int )
    prefRowColumn( int )

    ":focus" { ... }

    ":read_only" { ... }

    child( "scroll_pane" ) {
        child( ".viewport" ) {
            child( ".container" ) { // Or use "descendant" rather than 3 levels of nesting.
                // The text is drawn here
            }
        }
    }
}

TextArea inherits all the features of TextInputControl.

Constructors

Link copied to clipboard
constructor(text: String = "")
constructor(stringProperty: StringProperty)
constructor(document: TextDocument)