TextAreaBase

abstract class TextAreaBase<D : TextDocument>(val document: D) : TextInputControl

The base class for TextArea and StyledTextArea.

The only difference between the two implementations :

  1. The type of the document (TextDocument vs StyledTextDocument).

  2. How the text is rendered.

  3. StyledTextArea has additional methods to add/remove HighlightRanges.

Therefore, TextArea and StyledTextArea classes are quite small; most of the code is in this base class.

Inheritors

Constructors

Link copied to clipboard
constructor(document: D)

Properties

Link copied to clipboard
Link copied to clipboard

Along with caretPosition, this defines the extent of the selection. If anchorPosition == caretPosition, then nothing is selected.

Link copied to clipboard
Link copied to clipboard

The caret is the vertical flashing bar between two characters, where text can be typed. When text is selected, caretPosition can be either end of the selection. See selectionStartProperty and selectionEndProperty.

Link copied to clipboard

The base class Node has no children, so this is an empty list.

Link copied to clipboard

The behaviour for each Action in TextAreaActions.

Link copied to clipboard
val document: D
Link copied to clipboard
Link copied to clipboard

The distance from the top of one line of text to the top of the next line, as a proportion of the font's height. i.e. 1 for the 'normal' distance. However, 1 looks a little cramped, and therefore 1.2 is often the 'standard' value.

Link copied to clipboard
Link copied to clipboard

Used to calculate the preferred width of this Node.

Link copied to clipboard
Link copied to clipboard

Used to calculate the preferred height of this Node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

TextArea does NOT store the document as a String, it is stored as a list of strings where each item in the list does NOT contain a new line character.

Link copied to clipboard
override val textSelected: Boolean
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
Link copied to clipboard
fun insert(at: TextPosition, text: String)
Link copied to clipboard
fun moveCaretAndAnchor(position: TextPosition?, scrollTo: Boolean = true, focus: Boolean = true)
Link copied to clipboard
open override fun nodeMinHeight(): Float

Each subclass of node can determine the minimum width it requires. This can be overridden on an ad-hoc basis using overrideMinHeight. The default implementation returns 0.

Link copied to clipboard
open override fun nodeMinWidth(): Float

Each subclass of node can determine the minimum width it requires. This can be overridden on an ad-hoc basis using overrideMinWidth. The default implementation returns 0.

Link copied to clipboard
open override fun nodePrefHeight(): Float

Each subclass of node can determine its preferred height. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.

Link copied to clipboard
open override fun nodePrefWidth(): Float

Each subclass of node can determine its preferred width. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.

Link copied to clipboard
fun redo()
Link copied to clipboard
fun replace(from: TextPosition, to: TextPosition, text: String)
Link copied to clipboard
fun replaceSelection(replacement: String)

Replaces the text between anchorPosition and caretPosition with replacement text. The caret is advanced to the end of the replaced text.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun undo()