Top Description Inners Methods
org.fxmisc.richtext

public Interface NavigationActions<PS, SEG, S>

extends TextEditingArea<PS, SEG, S>
Known Direct Implementers
org.fxmisc.richtext.GenericStyledArea
Imports
java.text.BreakIterator

Specifies actions for moving the caret and/or making a selection for a TextEditingArea.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
NavigationActions.SelectionPolicy

Indicates how to treat selection when caret is moved.

Method Summary

Modifier and TypeMethod and Description
public default void
deselect()

Clears the selection while keeping the caret position.

public default void
end(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the end of the text.

public default void
moveTo(int pos)

Moves the caret to the given position in the text and clears any selection.

public default void
moveTo(int
the index of the paragraph to which to move the caret
paragraphIndex
,
int
the index to the left of which to move the caret
columnIndex
)

Moves the caret to the position returned from getAbsolutePosition(paragraphIndex, columnIndex) and clears any selection.

public default void
moveTo(int position, NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the given position.

public default void
moveTo(int paragraphIndex, int columnIndex, NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the position returned from getAbsolutePosition(paragraphIndex, columnIndex) using the given selection policy.

public default void
nextChar(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret forward one char in the text.

public default void
paragraphEnd(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the end of the current paragraph.

public default void
paragraphStart(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the beginning of the current paragraph.

public default void
previousChar(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret backward one char in the text.

public default void
selectAll()

Selects everything in the area.

public default void
selectParagraph()

Selects the current paragraph.

public default void
selectWord()

Selects the word closest to the caret

public default void
start(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the beginning of the text.

public default void
wordBreaksBackwards(int n, NavigationActions.SelectionPolicy selectionPolicy)

Skips n number of word boundaries backwards.

public default void
wordBreaksForwards(int n, NavigationActions.SelectionPolicy selectionPolicy)

Skips n number of word boundaries forward.

Inherited from org.fxmisc.richtext.TextEditingArea:
anchorPropertybeingUpdatedPropertycaretBoundsPropertycaretColumnPropertycaretPositionPropertycreateMultiChangecreateMultiChangecurrentParagraphPropertydisplaceCaretdisposegetAbsolutePositiongetAnchorgetCaretBoundsgetCaretColumngetCaretPositiongetCaretSelectionBindgetContentgetCurrentParagraphgetDocumentgetLengthgetLocalegetParagraphgetParagraphLengthgetParagraphsgetParagraphSelectiongetParagraphSelectiongetSegOpsgetSelectedTextgetSelectiongetSelectionBoundsgetShowCaretgetTextgetTextgetTextgetTextgetTextisBeingUpdatedlengthPropertymultiPlainChangesmultiRichChangesplainTextChangesreplacereplacereplacereplacereplacereplacereplaceTextreplaceTextreplaceTextrichChangesselectedTextPropertyselectionBoundsPropertyselectionPropertyselectRangeselectRangesetShowCaretshowCaretPropertysubDocumentsubDocumentsubDocumentsubDocumenttextProperty

Method Detail

deselectback to summary
public default void deselect()

Clears the selection while keeping the caret position.

endback to summary
public default void end(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the end of the text.

moveToback to summary
public default void moveTo(int pos)

Moves the caret to the given position in the text and clears any selection.

moveToback to summary
public default void moveTo(int paragraphIndex, int columnIndex)

Moves the caret to the position returned from getAbsolutePosition(paragraphIndex, columnIndex) and clears any selection.

For example, if "|" represents the caret, "_" represents a newline character, and given the text "Some_Text" (1st line: 'Some'; 2nd line 'Text'), then...

  • calling moveTo(0, 4) results in "Some|_Text" (caret to the left of "_")
  • calling moveTo(1, -1) results in "Some|_Text" (caret in the left of "_")
  • calling moveTo(1, 0) results in "Some_|Text" (caret in the left of "T")
  • calling moveTo(0, 5) results in "Some_|Text" (caret in the left of "T")

Caution

see getAbsolutePosition(int, int) to know how the column index argument can affect the returned position.

Parameters
paragraphIndex:int

the index of the paragraph to which to move the caret

columnIndex:int

the index to the left of which to move the caret

moveToback to summary
public default void moveTo(int position, NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the given position.

moveToback to summary
public default void moveTo(int paragraphIndex, int columnIndex, NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the position returned from getAbsolutePosition(paragraphIndex, columnIndex) using the given selection policy.

Caution

see getAbsolutePosition(int, int) to know how the column index argument can affect the returned position.

nextCharback to summary
public default void nextChar(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret forward one char in the text.

paragraphEndback to summary
public default void paragraphEnd(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the end of the current paragraph.

paragraphStartback to summary
public default void paragraphStart(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the beginning of the current paragraph.

previousCharback to summary
public default void previousChar(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret backward one char in the text.

selectAllback to summary
public default void selectAll()

Selects everything in the area.

selectParagraphback to summary
public default void selectParagraph()

Selects the current paragraph.

selectWordback to summary
public default void selectWord()

Selects the word closest to the caret

startback to summary
public default void start(NavigationActions.SelectionPolicy selectionPolicy)

Moves the caret to the beginning of the text.

wordBreaksBackwardsback to summary
public default void wordBreaksBackwards(int n, NavigationActions.SelectionPolicy selectionPolicy)

Skips n number of word boundaries backwards.

wordBreaksForwardsback to summary
public default void wordBreaksForwards(int n, NavigationActions.SelectionPolicy selectionPolicy)

Skips n number of word boundaries forward.

org.fxmisc.richtext back to summary

public final Enum NavigationActions.SelectionPolicy

extends Enum<NavigationActions.SelectionPolicy>
Class Inheritance

Indicates how to treat selection when caret is moved.

Field Summary

Modifier and TypeField and Description
public static final NavigationActions.SelectionPolicy
ADJUST

Moves the caret only without also moving the anchor, thereby making a selection

public static final NavigationActions.SelectionPolicy
CLEAR

Move the caret and anchor to the same given position, thereby clearing any existing selection

public static final NavigationActions.SelectionPolicy
EXTEND

Extends the selection by updating the "boundary" of the selection that is closest to the new position (i.e. either the selection's start or end position) to that new position and keeping the other position the same.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static NavigationActions.SelectionPolicy
public static NavigationActions.SelectionPolicy[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ADJUSTback to summary
public static final NavigationActions.SelectionPolicy ADJUST

Moves the caret only without also moving the anchor, thereby making a selection

CLEARback to summary
public static final NavigationActions.SelectionPolicy CLEAR

Move the caret and anchor to the same given position, thereby clearing any existing selection

EXTENDback to summary
public static final NavigationActions.SelectionPolicy EXTEND

Extends the selection by updating the "boundary" of the selection that is closest to the new position (i.e. either the selection's start or end position) to that new position and keeping the other position the same. In either case, the caret position is updated to that new position while the anchor is updated to the opposite boundary.

Using the following example, where "||" is the anchor, "|" is the caret" and "_" is the new position, EXTEND updates the values to:


"A text ||with| a _selection" -> "A text ||with a |selection"
"A _text ||with| a selection" -> "A |text with|| a selection"

Constructor Detail

SelectionPolicyback to summary
private SelectionPolicy()

Method Detail

valueOfback to summary
public static NavigationActions.SelectionPolicy valueOf(String name)
valuesback to summary
public static NavigationActions.SelectionPolicy[] values()