Top Description Fields Constructors Methods
org.fxmisc.richtext

public Class GenericStyledArea<PS, SEG, S>

extends Region
implements TextEditingArea<PS, SEG, S>, EditActions<PS, SEG, S>, ClipboardActions<PS, SEG, S>, NavigationActions<PS, SEG, S>, StyleActions<PS, S>, UndoActions, ViewActions<PS, SEG, S>, TwoDimensional, Virtualized
Class Inheritance
All Implemented Interfaces
org.fxmisc.flowless.Virtualized, org.fxmisc.richtext.model.TwoDimensional, org.fxmisc.richtext.ViewActions, org.fxmisc.richtext.UndoActions, org.fxmisc.richtext.StyleActions, org.fxmisc.richtext.NavigationActions, org.fxmisc.richtext.TextEditingArea, org.fxmisc.richtext.ClipboardActions, org.fxmisc.richtext.EditActions
Known Direct Subclasses
org.fxmisc.richtext.StyledTextArea
Type Parameters
<PS>
type of style that can be applied to paragraphs (e.g. TextFlow.
<SEG>
type of segment used in Paragraph. Can be only text (plain or styled) or a type that combines text and other Nodes.
<S>
type of style that can be applied to a segment.
Static Imports
org.reactfx.EventStreams.*, org.reactfx.util.Tuples.*

Text editing control that renders and edits a EditableStyledDocument. Accepts user input (keyboard, mouse) and provides API to assign style to text ranges. It is suitable for syntax highlighting and rich-text editors.

Adding Scrollbars to the Area

By default, scroll bars do not appear when the content spans outside of the viewport. To add scroll bars, the area needs to be wrapped in a VirtualizedScrollPane. For example,


// shows area without scroll bars
InlineCssTextArea area = new InlineCssTextArea();

// add scroll bars that will display as needed
VirtualizedScrollPane<InlineCssTextArea> vsPane = new VirtualizedScrollPane<>(area);

Parent parent = // creation code
parent.getChildren().add(vsPane)

Auto-Scrolling to the Caret

Every time the underlying EditableStyledDocument changes via user interaction (e.g. typing) through the GenericStyledArea, the area will scroll to insure the caret is kept in view. However, this does not occur if changes are done programmatically. For example, let's say the area is displaying the bottom part of the area's EditableStyledDocument and some code changes something in the top part of the document that is not currently visible. If there is no call to requestFollowCaret() at the end of that code, the area will not auto-scroll to that section of the document. The change will occur, and the user will continue to see the bottom part of the document as before. If such a call is there, then the area will scroll to the top of the document and no longer display the bottom part of it.

For example...


// assuming the user is currently seeing the top of the area

// then changing the bottom, currently not visible part of the area...
int startParIdx = 40;
int startColPosition = 2;
int endParIdx = 42;
int endColPosition = 10;

// ...by itself will not scroll the viewport to where the change occurs
area.replaceText(startParIdx, startColPosition, endParIdx, endColPosition, "replacement text");

// adding this line after the last modification to the area will cause the viewport to scroll to that change
// leaving the following line out will leave the viewport unaffected and the user will not notice any difference
area.requestFollowCaret();

Additionally, when overriding the default user-interaction behavior, remember to include a call to requestFollowCaret().

Setting the area's UndoManager

The default UndoManager can undo/redo either PlainTextChanges or RichTextChanges. To create your own specialized version that may use changes different than these (or a combination of these changes with others), create them using the convenient factory methods in UndoUtils.

Overriding default keyboard behavior

GenericStyledArea uses KEY_TYPED to handle ordinary character input and KEY_PRESSED to handle control key combinations (including Enter and Tab). To add or override some keyboard shortcuts, while keeping the rest in place, you would combine the default event handler with a new one that adds or overrides some of the default key combinations.

For example, this is how to bind Ctrl+S to the save() operation:


import static javafx.scene.input.KeyCode.*;
import static javafx.scene.input.KeyCombination.*;
import static org.fxmisc.wellbehaved.event.EventPattern.*;
import static org.fxmisc.wellbehaved.event.InputMap.*;

import org.fxmisc.wellbehaved.event.Nodes;

// installs the following consume InputMap,
// so that a CTRL+S event saves the document and consumes the event
Nodes.addInputMap(area, consume(keyPressed(S, CONTROL_DOWN), event -> save()));

Overriding default mouse behavior

The area's default mouse behavior properly handles auto-scrolling and dragging the selected text to a new location. As such, some parts cannot be partially overridden without it affecting other behavior.

The following lists either org.fxmisc.wellbehaved.event.EventPatterns that cannot be overridden without negatively affecting the default mouse behavior or describe how to safely override things in a special way without disrupting the auto scroll behavior.

CSS, Style Classes, and Pseudo Classes

Refer to the RichTextFX CSS Reference Guide .

Area Actions and Other Operations

To distinguish the actual operations one can do on this area from the boilerplate methods within this area (e.g. properties and their getters/setters, etc.), look at the interfaces this area implements. Each lists and documents methods that fall under that category.

To update multiple portions of the area's underlying document in one call, see createMultiChange().

Calculating a Position Within the Area

To calculate a position or index within the area, read through the javadoc of org.fxmisc.richtext.model.TwoDimensional and org.fxmisc.richtext.model.TwoDimensional.Bias. Also, read the difference between "position" and "index" in org.fxmisc.richtext.model.StyledDocument#getAbsolutePosition(int, int).

See Also
EditableStyledDocument, TwoDimensional, org.fxmisc.richtext.model.TwoDimensional.Bias, VirtualFlow, VirtualizedScrollPane, Caret, Selection, CaretSelectionBind

Field Summary

Modifier and TypeField and Description
private final BiConsumer<TextFlow, PS>
private final EventStream<Boolean>
private BooleanProperty
private final BooleanProperty
private final SuspendableNo
private double
private CaretSelectionBind<PS, SEG, S>
private final SubscribeableContentsObsSet<CaretNode>
private final EditableStyledDocument<PS, SEG, S>
private ObjectProperty<ContextMenu>
private DoubleProperty
private DoubleProperty
private static final List<CssMetaData<? extends Styleable, ?>>
private final BooleanProperty
public static final IndexRange
EMPTY_RANGE

Index range [0, 0).

private static final PseudoClass
protected boolean
private boolean
private static final PseudoClass
private static final CssMetaData<GenericStyledArea<?, ?, ?>, Paint>
private final StyleableObjectProperty<Paint>
highlightTextFill

Text color for highlighted text.

private int
private int
private final PS
private final S
private PS
private S
private static final PseudoClass
private LineSelection<PS, SEG, S>
private ObjectProperty<Paint>
private final ObjectProperty<Duration>
private final ObjectProperty<EventHandler<MouseEvent>>
private final ObjectProperty<Consumer<Point2D>>
private final ObjectProperty<EventHandler<MouseEvent>>
private final ObjectProperty<EventHandler<MouseEvent>>
private final ObjectProperty<Consumer<Point2D>>
private final ObjectProperty<EventHandler<MouseEvent>>
private final ReadOnlyBooleanProperty
private boolean
private final ObjectProperty<IntFunction<? extends Node>>
private final TwoLevelNavigator
private Node
private Pos
private ObjectProperty<Node>
private boolean
private final boolean
private static final PseudoClass
private final TextOps<SEG, S>
private final SubscribeableContentsObsSet<Selection<PS, SEG, S>>
private Optional<Tuple2<Codec<PS>, Codec<StyledSegment<SEG, S>>>>
private Subscription
private Locale
private UndoManager<C>
private final BooleanProperty
private final SuspendableEventStream<?>
private final VirtualFlow<Paragraph<PS, SEG, S>, Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>>>
private final SuspendableList<Paragraph<PS, SEG, S>>
visibleParagraphs

References Deprecated SuspendableList is deprecated or references (maybe indirectly) at least one deprecated element.
private final BooleanProperty
Inherited from javafx.scene.layout.Region:
USE_COMPUTED_SIZEUSE_PREF_SIZE

Constructor Summary

AccessConstructor and Description
public
GenericStyledArea(PS
style to use in places where no other style is specified (yet).
initialParagraphStyle
,
BiConsumer<TextFlow, PS>
function that, given a TextFlow node and a style, applies the style to the paragraph node. This function is used by the default skin to apply style to paragraph nodes.
applyParagraphStyle
,
S
style to use in places where no other style is specified (yet).
initialTextStyle
,
TextOps<SEG, S>
The operations which are defined on the text segment objects.
segmentOps
,
Function<StyledSegment<SEG, S>, Node>
A function which is used to create the JavaFX scene nodes for a particular segment.
nodeFactory
)

Creates a text area with empty text content.

public
GenericStyledArea(PS
style to use in places where no other style is specified (yet).
initialParagraphStyle
,
BiConsumer<TextFlow, PS>
function that, given a TextFlow node and a style, applies the style to the paragraph node. This function is used by the default skin to apply style to paragraph nodes.
applyParagraphStyle
,
S
style to use in places where no other style is specified (yet).
initialTextStyle
,
TextOps<SEG, S>
The operations which are defined on the text segment objects.
segmentOps
,
boolean
whether to use an undo manager that can undo/redo RichTextChanges or PlainTextChanges
preserveStyle
,
Function<StyledSegment<SEG, S>, Node>
A function which is used to create the JavaFX scene node for a particular segment.
nodeFactory
)

Same as GenericStyledArea(Object, BiConsumer, Object, TextOps, Function) but also allows one to specify whether the undo manager should be a plain or rich undo manager via preserveStyle.

public
GenericStyledArea(PS initialParagraphStyle, BiConsumer<TextFlow, PS> applyParagraphStyle, S initialTextStyle, EditableStyledDocument<PS, SEG, S> document, TextOps<SEG, S> segmentOps, Function<StyledSegment<SEG, S>, Node> nodeFactory)

The same as GenericStyledArea(Object, BiConsumer, Object, TextOps, Function) except that this constructor can be used to create another GenericStyledArea that renders and edits the same EditableStyledDocument or when one wants to use a custom EditableStyledDocument implementation.

public
GenericStyledArea(PS
style to use in places where no other style is specified (yet).
initialParagraphStyle
,
BiConsumer<TextFlow, PS>
function that, given a TextFlow node and a style, applies the style to the paragraph node. This function is used by the default skin to apply style to paragraph nodes.
applyParagraphStyle
,
S
style to use in places where no other style is specified (yet).
initialTextStyle
,
EditableStyledDocument<PS, SEG, S>
the document to render and edit
document
,
TextOps<SEG, S>
The operations which are defined on the text segment objects.
segmentOps
,
boolean
whether to use an undo manager that can undo/redo RichTextChanges or PlainTextChanges
preserveStyle
,
Function<StyledSegment<SEG, S>, Node>
A function which is used to create the JavaFX scene node for a particular segment.
nodeFactory
)

Creates an area with flexibility in all of its options.

Method Summary

Modifier and TypeMethod and Description
public final boolean
public final boolean
addSelection(Selection<PS, SEG, S> selection)

public final Optional<Integer>
public BooleanProperty
public final BooleanProperty
public final SuspendableNo
beingUpdatedProperty()

Implements org.fxmisc.richtext.TextEditingArea.beingUpdatedProperty.

True when an update to the area's underling editable document is still occurring or the viewport is being updated.

pack-priv void
protected double
computePrefHeight(double width)

Overrides javafx.scene.layout.Region.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy.

protected void
configurePlaceholder(Node placeholder)

Override this to customize the placeholder's layout.

public final ObjectProperty<ContextMenu>
public final DoubleProperty
public final DoubleProperty
private Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>>
createCell(Paragraph<PS, SEG, S> paragraph, BiConsumer<TextFlow, PS> applyParagraphStyle, Function<StyledSegment<SEG, S>, Node> nodeFactory)

public MultiChangeBuilder<PS, SEG, S>
createMultiChange()

Implements org.fxmisc.richtext.TextEditingArea.createMultiChange.

Starts building a list of changes to be used to update multiple portions of the underlying document in one call.

public MultiChangeBuilder<PS, SEG, S>
createMultiChange(int initialNumOfChanges)

Implements org.fxmisc.richtext.TextEditingArea.createMultiChange.

Same as createMultiChange() but the number of changes are specified to be more memory efficient.

pack-priv TwoDimensional.Position
currentLine()

Returns the current line as a two-level index.

public void
displaceCaret(int pos)

Implements org.fxmisc.richtext.TextEditingArea.displaceCaret.

Displaces the caret from the selection by positioning only the caret to the new location without also affecting the selection's anchor or the selection.

private void
displayPlaceHolder(boolean show, Node newNode)

public void
dispose()

Implements org.fxmisc.richtext.TextEditingArea.dispose.

Disposes this area, preventing memory leaks.

public final BooleanProperty
public Var<Double>
public Var<Double>
private static Bounds
extendLeft(Bounds b, double w)

protected void
fold(int startPos, int endPos, UnaryOperator<PS>
Given a paragraph style PS, return a new PS that will activate folding.
styleMixin
)

Folds (hides/collapses) paragraphs from character position startPos to endPos, into (i.e. excluding) the first paragraph of the range.

protected void
foldParagraphs(int start, int end, UnaryOperator<PS>
Given a paragraph style PS, return a new PS that will activate folding.

See fold(int, int, UnaryOperator) for more info.

styleMixin
)

Folds (hides/collapses) paragraphs from start to end, into (i.e. excluding) the first paragraph of the range.

protected void
foldSelectedParagraphs(UnaryOperator<PS>
Given a paragraph style PS, return a new PS that will activate folding.

See fold(int, int, UnaryOperator) for more info.

styleMixin
)

Convenience method to fold (hide/collapse) the currently selected paragraphs, into (i.e. excluding) the first paragraph of the range.

private void
followCaret()

Assumes this method is called within a suspendVisibleParsWhile(Runnable) block

public int
getAbsolutePosition(int paragraphIndex, int columnIndex)

Implements org.fxmisc.richtext.TextEditingArea.getAbsolutePosition.

Returns the absolute position (i.e. the spot in-between characters) to the left of the given column in the given paragraph.

public final BiConsumer<TextFlow, PS>
public final <T extends Node & Caret> Optional<Bounds>
getCaretBoundsOnScreen(T caret)

Implements org.fxmisc.richtext.ViewActions.getCaretBoundsOnScreen.

Using the paragraph index of the "all paragraph" index system, returns the bounds of a caret on the given paragraph or Optional#empty() if no caret is on that paragraph or the pragraph is not visible.

pack-priv final ParagraphBox.CaretOffsetX
getCaretOffsetX(CaretNode caret)

Returns x coordinate of the caret in the current paragraph.

public final CaretSelectionBind<PS, SEG, S>
private ParagraphBox<PS, SEG, S>
getCell(int index)

public Optional<Bounds>
getCharacterBoundsOnScreen(int from, int to)

Implements org.fxmisc.richtext.ViewActions.getCharacterBoundsOnScreen.

Gets the character bounds on screen

public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.layout.Region.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public final EditableStyledDocument<PS, SEG, S>
getContent()

Implements org.fxmisc.richtext.TextEditingArea.getContent.

The underlying document of this area that can be displayed by multiple StyledTextAreas.

public ContextMenu
getContextMenu()

Overrides default org.fxmisc.richtext.ViewActions.getContextMenu.

Gets the ContextMenu for the area, which is by default null.

public double
getContextMenuXOffset()

Overrides default org.fxmisc.richtext.ViewActions.getContextMenuXOffset.

Gets the horizontal amount in pixels by which to offset the getContextMenu() when it is shown, which has a default value of 2.

public double
getContextMenuYOffset()

Overrides default org.fxmisc.richtext.ViewActions.getContextMenuYOffset.

Gets the vertical amount in pixels by which to offset the getContextMenu() when it is shown, which has a default value of 2.

public List<CssMetaData<? extends Styleable, ?>>
getCssMetaData()

Overrides javafx.scene.layout.Region.getCssMetaData.

Implements javafx.css.Styleable.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

public int
public int
public final StyledDocument<PS, SEG, S>
getDocument()

Implements org.fxmisc.richtext.TextEditingArea.getDocument.

Rich-text content of this text-editing area.

public final PS
getInitialParagraphStyle()

Implements org.fxmisc.richtext.StyleActions.getInitialParagraphStyle.

Style used by default when no other style is provided.

public final S
getInitialTextStyle()

Implements org.fxmisc.richtext.StyleActions.getInitialTextStyle.

Style used by default when no other style is provided.

public Locale

Returns:

Locale.getDefault() by default
getLocale
()

Overrides default org.fxmisc.richtext.TextEditingArea.getLocale.

This is used to determine word and sentence breaks while navigating or selecting.

public final EventHandler<MouseEvent>
public final EventHandler<MouseEvent>
public final EventHandler<MouseEvent>
public final EventHandler<MouseEvent>
public Optional<Bounds>
getParagraphBoundsOnScreen(int paragraphIndex)

Implements org.fxmisc.richtext.ViewActions.getParagraphBoundsOnScreen.

Returns the bounds of the paragraph if it is visible or Optional#empty() if it's not.

private Bounds
getParagraphBoundsOnScreen(Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>> cell)

public Node
getParagraphGraphic(int parNdx)

public final PS
public int
getParagraphLinesCount(int paragraphIndex)

Implements org.fxmisc.richtext.ViewActions.getParagraphLinesCount.

Gets the number of lines a paragraph spans when isWrapText() is true, or otherwise returns 1.

private int
getParagraphOffset(int parIdx)

public LiveList<Paragraph<PS, SEG, S>>
getParagraphs()

Implements org.fxmisc.richtext.TextEditingArea.getParagraphs.

Unmodifiable observable list of paragraphs in this text area.

public IndexRange
public final PS
getParagraphStyleForInsertionAt(int pos)

Implements org.fxmisc.richtext.StyleActions.getParagraphStyleForInsertionAt.

Returns getInitialParagraphStyle() if getUseInitialStyleForInsertion() is true; otherwise, returns the paragraph style at the given position.

public final Node
private Optional<Bounds>
getRangeBoundsOnScreen(int paragraphIndex, int from, int to)

public final TextOps<SEG, S>
getSegOps()

Implements org.fxmisc.richtext.TextEditingArea.getSegOps, org.fxmisc.richtext.ClipboardActions.getSegOps.

Returns the object used for operating over segments and their styles

pack-priv final Optional<Bounds>
getSelectionBoundsOnScreen(Selection<PS, SEG, S> selection)

public S
getStyleAtPosition(int position)

Implements org.fxmisc.richtext.StyleActions.getStyleAtPosition.

Returns the style at the given position.

public S
getStyleAtPosition(int paragraph, int position)

Implements org.fxmisc.richtext.StyleActions.getStyleAtPosition.

Returns the style at the given position in the given paragraph.

public Optional<Tuple2<Codec<PS>, Codec<StyledSegment<SEG, S>>>>
getStyleCodecs()

Implements org.fxmisc.richtext.ClipboardActions.getStyleCodecs.

Gets codecs to encode/decode style information to/from binary format.

public S
getStyleOfChar(int index)

Implements org.fxmisc.richtext.StyleActions.getStyleOfChar.

Returns the style of the character with the given index.

public S
getStyleOfChar(int paragraph, int index)

Implements org.fxmisc.richtext.StyleActions.getStyleOfChar.

Returns the style of the character with the given index in the given paragraph.

public IndexRange
getStyleRangeAtPosition(int position)

Implements org.fxmisc.richtext.StyleActions.getStyleRangeAtPosition.

Returns the range of homogeneous style that includes the given position.

public IndexRange
getStyleRangeAtPosition(int paragraph, int position)

Implements org.fxmisc.richtext.StyleActions.getStyleRangeAtPosition.

Returns the range of homogeneous style that includes the given position in the given paragraph.

public StyleSpans<S>
getStyleSpans(int from, int to)

Implements org.fxmisc.richtext.StyleActions.getStyleSpans.

Returns the styles in the given character range.

public StyleSpans<S>
getStyleSpans(int paragraph)

Implements org.fxmisc.richtext.StyleActions.getStyleSpans.

Returns styles of the whole paragraph.

public StyleSpans<S>
getStyleSpans(int paragraph, int from, int to)

Implements org.fxmisc.richtext.StyleActions.getStyleSpans.

Returns the styles in the given character range of the given paragraph.

pack-priv ParagraphBox.CaretOffsetX
public final String
getText(int start, int end)

Implements org.fxmisc.richtext.TextEditingArea.getText.

Returns text content of the given character range.

public String
getText(int paragraph)

Implements org.fxmisc.richtext.TextEditingArea.getText.

Returns text content of the given paragraph.

public String
getText(IndexRange range)

Implements org.fxmisc.richtext.TextEditingArea.getText.

Returns text content of the given character range.

public final S
public final S
getTextStyleForInsertionAt(int pos)

Implements org.fxmisc.richtext.StyleActions.getTextStyleForInsertionAt.

Returns getInitialTextStyle() if getUseInitialStyleForInsertion() is true; otherwise, returns the style at the given position.

public UndoManager<C>
getUndoManager()

Implements org.fxmisc.richtext.UndoActions.getUndoManager.

Undo manager of this text area.

public final double
getViewportHeight()

Implements org.fxmisc.richtext.ViewActions.getViewportHeight.

Gets the height of the viewport and ignores the padding values added to the area.

public Bounds
getVisibleParagraphBoundsOnScreen(int visibleParagraphIndex)

Implements org.fxmisc.richtext.ViewActions.getVisibleParagraphBoundsOnScreen.

Returns the bounds of the paragraph if it is visible or Optional#empty() if it's not.

public final LiveList<Paragraph<PS, SEG, S>>
getVisibleParagraphs()

Implements org.fxmisc.richtext.ViewActions.getVisibleParagraphs.

Gets the visible paragraphs, even the ones that are barely displayed.

protected void
public CharacterHit
hit(double x, double y)

Implements org.fxmisc.richtext.ViewActions.hit.

Helpful for determining which letter is at point x, y:

    StyledTextArea area = // creation code
    area.addEventHandler(MouseEvent.MOUSE_PRESSED, (MouseEvent e) -> {
        CharacterHit hit = area.hit(e.getX(), e.getY());
        int characterPosition = hit.getInsertionIndex();

        // move the caret to that character's position
        area.moveTo(characterPosition, SelectionPolicy.CLEAR);
    }
pack-priv CharacterHit
pack-priv CharacterHit
private void
public boolean
public boolean
isAutoScrollOnDragDesired()

Overrides default org.fxmisc.richtext.ViewActions.isAutoScrollOnDragDesired.

Indicates whether area should auto scroll towards a MouseEvent#MOUSE_DRAGGED event.

protected final boolean
public boolean
isEditable()

Overrides default org.fxmisc.richtext.ViewActions.isEditable.

Indicates whether this text area can be edited by the user.

public boolean
public boolean
public final boolean
isPreserveStyle()

Implements org.fxmisc.richtext.StyleActions.isPreserveStyle.

Indicates whether style should be preserved on undo/redo (and in the future copy/paste and text move).

public boolean
isWrapText()

Overrides default org.fxmisc.richtext.ViewActions.isWrapText.

When a run of text exceeds the width of the text region, then this property indicates whether the text should wrap onto another line.

protected void
layoutChildren()

Overrides javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

public final ObservableValue<Integer>
public void
lineEnd(NavigationActions.SelectionPolicy policy)

Implements org.fxmisc.richtext.ViewActions.lineEnd.

Move the caret to the end of either the line in a multi-line wrapped paragraph or the paragraph in a single-line / non-wrapped paragraph

public final int
lineIndex(int paragraphIndex, int columnPosition)

Implements org.fxmisc.richtext.ViewActions.lineIndex.

Returns 0 if the given paragraph displays its content across only one line, or returns the index of the line on which the given column position appears if the paragraph spans multiple lines.

public void
lineStart(NavigationActions.SelectionPolicy policy)

Implements org.fxmisc.richtext.ViewActions.lineStart.

Move the caret to the start of either the line in a multi-line wrapped paragraph or the paragraph in a single-line / non-wrapped paragraph

private void
public ObjectProperty<Duration>
private EventStream<MouseOverTextEvent>
public EventStream<List<PlainTextChange>>
public EventStream<List<RichTextChange<PS, SEG, S>>>
public void
nextLine(NavigationActions.SelectionPolicy selectionPolicy)

Scrolls the text one line UP while maintaining the caret's position on screen, so that it is now on the NEXT line.

public void
nextPage(NavigationActions.SelectionPolicy selectionPolicy)

Implements org.fxmisc.richtext.ViewActions.nextPage.

Moves caret to the next page (i.e. page down)

public TwoDimensional.Position
offsetToPosition(int charOffset, TwoDimensional.Bias bias)

Implements org.fxmisc.richtext.model.TwoDimensional.offsetToPosition.

Creates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length) where the offset value is an absolute position in that entity.

public final ObjectProperty<EventHandler<MouseEvent>>
public final ObjectProperty<EventHandler<MouseEvent>>
public final ObjectProperty<Consumer<Point2D>>
public final ObjectProperty<EventHandler<MouseEvent>>
public final ObjectProperty<Consumer<Point2D>>
public final ObjectProperty<EventHandler<MouseEvent>>
public final ReadOnlyBooleanProperty
overwriteModeProperty()

Indicates weather the area is in overwrite or insert mode.

private void
page(int
the number of pages to page up/down.
Negative numbers for paging up and positive for down.
pgCount
,
NavigationActions.SelectionPolicy selectionPolicy)

public ObjectProperty<IntFunction<? extends Node>>
public final ObjectProperty<Node>
public final EventStream<PlainTextChange>
public TwoDimensional.Position
position(int row, int col)

Implements org.fxmisc.richtext.model.TwoDimensional.position.

Creates a two dimensional position in some entity (e.g. area, list of lists, list of some object with length) where the major value is the index within the outer list) and the minor value is either the index within the inner list or some amount of length in a list of objects that have length.

public void
prevLine(NavigationActions.SelectionPolicy selectionPolicy)

Scrolls the text one line DOWN while maintaining the caret's position on screen, so that it is now on the PREVIOUS line.

public void
prevPage(NavigationActions.SelectionPolicy selectionPolicy)

Implements org.fxmisc.richtext.ViewActions.prevPage.

Moves caret to the previous page (i.e. page up)

public void
public final boolean
public final boolean
removeSelection(Selection<PS, SEG, S> selection)

public void
replace(int start, int end, SEG seg, S style)

Implements org.fxmisc.richtext.TextEditingArea.replace.

Replaces a range of characters with the given segment.

public void
replace(int start, int end, StyledDocument<PS, SEG, S> replacement)

Implements org.fxmisc.richtext.TextEditingArea.replace.

Replaces a range of characters with the given rich-text document.

pack-priv void
replaceMulti(List<Replacement<PS, SEG, S>> replacements)

public void
replaceText(int start, int end, String text)

Implements org.fxmisc.richtext.TextEditingArea.replaceText.

Replaces a range of characters with the given text.

public void
requestFollowCaret()

Implements org.fxmisc.richtext.ViewActions.requestFollowCaret.

If the caret is not visible within the area's view, the area will scroll so that caret is visible in the next layout pass.

public final EventStream<RichTextChange<PS, SEG, S>>
public void
scrollBy(Point2D deltas)

Overrides default org.fxmisc.flowless.Virtualized.scrollBy.

Convenience method: scroll horizontally by deltas.getX() and vertically by deltas.getY()

private void
scrollLine(int direction, NavigationActions.SelectionPolicy selectionPolicy)

Scrolls the text (direction*caretHeight) while maintaining the caret's current position on screen.

private void
scrollText(double deltaY, NavigationActions.SelectionPolicy selectionPolicy)

Scrolls the text by deltaY while maintaining the caret's current position on screen.

public void
scrollXBy(double deltaX)

Implements org.fxmisc.flowless.Virtualized.scrollXBy.

Scroll the content horizontally by the given amount.

public void
scrollXToPixel(double pixel)

Implements org.fxmisc.flowless.Virtualized.scrollXToPixel.

Scroll the content horizontally to the pixel

public void
scrollYBy(double deltaY)

Implements org.fxmisc.flowless.Virtualized.scrollYBy.

Scroll the content vertically by the given amount.

public void
scrollYToPixel(double pixel)

Implements org.fxmisc.flowless.Virtualized.scrollYToPixel.

Scroll the content vertically to the pixel

public void
setAutoHeight(boolean value)

public void
public void
public void
public void
public void
public void
setLineHighlighterFill(Paint highlight)

The default fill is "highlighter" yellow.

public void
setLineHighlighterOn(boolean show)

Highlights the line that the main caret is on.

public void
setLocale(Locale editorLocale)

public final void
setOnInsideSelectionMousePressReleased(EventHandler<MouseEvent> handler)

Implements org.fxmisc.richtext.ViewActions.setOnInsideSelectionMousePressReleased.

Runs the EventHandler when the mouse is released in this scenario: the user has selected some text and then "clicked" the mouse somewhere in that selection (the use pressed the mouse, did not drag it, and released the mouse)

Note

this consumer is run on MouseEvent#MOUSE_RELEASED, not MouseEvent#MOUSE_CLICKED.

public final void
setOnNewSelectionDragFinished(EventHandler<MouseEvent> handler)

Implements org.fxmisc.richtext.ViewActions.setOnNewSelectionDragFinished.

Runs the EventHandler when the mouse is released in this scenario: the user has pressed the mouse over some unselected text, and dragged the mouse to a new location within the area, and released the mouse.

public final void
setOnOutsideSelectionMousePressed(EventHandler<MouseEvent> handler)

Implements org.fxmisc.richtext.ViewActions.setOnOutsideSelectionMousePressed.

Runs the EventHandler when the user pressed the mouse over unselected text within the area.

public final void
setOnSelectionDropped(EventHandler<MouseEvent> handler)

Implements org.fxmisc.richtext.ViewActions.setOnSelectionDropped.

Runs the EventHandler when the mouse is released in this scenario: the user has selected some text, pressed the mouse on top of the selection, dragged it to a new location within the area, and released the mouse within the area.

public final void
setParagraphInsertionStyle(PS paraStyle)

If you want to preset the style to be used.

public void
setParagraphStyle(int paragraph, PS paragraphStyle)

Implements org.fxmisc.richtext.StyleActions.setParagraphStyle.

Sets style for the whole paragraph.

public final void
setPlaceholder(Node value)

This Node is shown to the user, centered over the area, when the area has no text content.

public void
setPlaceholder(Node value, Pos where)

public void
setStyle(int from, int to, S style)

Implements org.fxmisc.richtext.StyleActions.setStyle.

Sets style for the given character range.

public void
setStyle(int paragraph, S style)

Implements org.fxmisc.richtext.StyleActions.setStyle.

Sets style for the whole paragraph.

public void
setStyle(int paragraph, int from, int to, S style)

Implements org.fxmisc.richtext.StyleActions.setStyle.

Sets style for the given range relative in the given paragraph.

public void
setStyleCodecs(Codec<PS> paragraphStyleCodec, Codec<StyledSegment<SEG, S>> styledSegCodec)

Implements org.fxmisc.richtext.ClipboardActions.setStyleCodecs.

public void
setStyleSpans(int from, StyleSpans<? extends S> styleSpans)

Implements org.fxmisc.richtext.StyleActions.setStyleSpans.

Set multiple style ranges at once.

public void
setStyleSpans(int paragraph, int from, StyleSpans<? extends S> styleSpans)

Implements org.fxmisc.richtext.StyleActions.setStyleSpans.

Set multiple style ranges of a paragraph at once.

public final void
setTextInsertionStyle(S txtStyle)

If you want to preset the style to be used for inserted text.

public void
setUndoManager(UndoManager<C>
may be null in which case a no op undo manager will be set.
undoManager
)

Implements org.fxmisc.richtext.UndoActions.setUndoManager.

Closes the current area's undo manager before setting it to the given one

Note

to create your own UndoManager, see the convenient factory methods in org.fxmisc.richtext.util.UndoUtils.

public void
pack-priv void
pack-priv void
public void
showParagraphAtBottom(int paragraphIndex)

Implements org.fxmisc.richtext.ViewActions.showParagraphAtBottom.

Lays out the viewport so that the paragraph is the last line (bottom) displayed in the viewport.

public void
showParagraphAtCenter(int paragraphIndex)

public void
showParagraphAtTop(int paragraphIndex)

Implements org.fxmisc.richtext.ViewActions.showParagraphAtTop.

Lays out the viewport so that the paragraph is the first line (top) displayed in the viewport.

public void
showParagraphInViewport(int paragraphIndex)

Implements org.fxmisc.richtext.ViewActions.showParagraphInViewport.

Shows the paragraph somewhere in the viewport.

public void
showParagraphRegion(int paragraphIndex, Bounds region)

Implements org.fxmisc.richtext.ViewActions.showParagraphRegion.

Lays out the viewport so that the given bounds (according to the paragraph's coordinate system) within the given paragraph is visible in the viewport.

private void
skipOverFoldedParagraphs(ObservableValue<? extends Integer> ob, Integer prevParagraph, Integer newParagraph)

public StyledDocument<PS, SEG, S>
subDocument(int start, int end)

Implements org.fxmisc.richtext.TextEditingArea.subDocument.

Returns rich-text content of the given character range.

public StyledDocument<PS, SEG, S>
subDocument(int paragraphIndex)

Implements org.fxmisc.richtext.TextEditingArea.subDocument.

Returns rich-text content of the given paragraph.

private void
public final ObservableValue<String>
public Val<Double>
public Val<Double>
protected void
unfoldParagraphs(int startingFrom, Predicate<PS>
Given a paragraph style PS check if it's folded.
isFolded
,
UnaryOperator<PS>
Given a paragraph style PS, return a new PS that excludes fold styling.
styleMixin
)

Unfolds paragraphs startingFrom onwards for the currently folded block.

public BooleanProperty
public final EventStream<?>
viewportDirtyEvents()

Implements org.fxmisc.richtext.ViewActions.viewportDirtyEvents.

Returns an EventStream that emits a null value every time the viewport becomes dirty (e.g. the viewport's width, height, scaleX, scaleY, estimatedScrollX, or estimatedScrollY values change)

public final int
visibleParToAllParIndex(int visibleParIndex)

Implements org.fxmisc.richtext.ViewActions.visibleParToAllParIndex.

Maps a paragraph index from getVisibleParagraphs() into the index system of TextEditingArea#getParagraphs().

public final BooleanProperty
Inherited from javafx.scene.layout.Region:
backgroundPropertyborderPropertycacheShapePropertycenterShapePropertycomputeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefWidthgetBackgroundgetBordergetHeightgetInsetsgetMaxHeightgetMaxWidthgetMinHeightgetMinWidthgetOpaqueInsetsgetPaddinggetPrefHeightgetPrefWidthgetShapegetUserAgentStylesheetgetWidthheightPropertyinsetsPropertyisCacheShapeisCenterShapeisResizableisScaleShapeisSnapToPixellayoutInArealayoutInArealayoutInArealayoutInAreamaxHeightmaxHeightPropertymaxWidthmaxWidthPropertyminHeightminHeightPropertyminWidthminWidthPropertyopaqueInsetsPropertypaddingPropertypositionInAreapositionInAreaprefHeightprefHeightPropertyprefWidthprefWidthPropertyresizescaleShapePropertysetBackgroundsetBordersetCacheShapesetCenterShapesetHeightsetMaxHeightsetMaxSizesetMaxWidthsetMinHeightsetMinSizesetMinWidthsetOpaqueInsetssetPaddingsetPrefHeightsetPrefSizesetPrefWidthsetScaleShapesetShapesetSnapToPixelsetWidthshapePropertysnappedBottomInsetsnappedLeftInsetsnappedRightInsetsnappedTopInsetsnapPositionsnapPositionXsnapPositionYsnapSizesnapSizeXsnapSizeYsnapSpacesnapSpaceXsnapSpaceYsnapToPixelPropertywidthProperty