Package org.fxmisc.richtext
Interface NavigationActions<PS,SEG,S>
-
- All Superinterfaces:
TextEditingArea<PS,SEG,S>
- All Known Implementing Classes:
CodeArea,GenericStyledArea,InlineCssTextArea,InlineCssTextField,StyleClassedTextArea,StyleClassedTextField,StyledTextArea,StyledTextField
public interface NavigationActions<PS,SEG,S> extends TextEditingArea<PS,SEG,S>
Specifies actions for moving the caret and/or making a selection for aTextEditingArea.
-
-
Property Summary
-
Properties inherited from interface org.fxmisc.richtext.TextEditingArea
anchor, beingUpdated, caretBounds, caretColumn, caretPosition, currentParagraph, length, selectedText, selectionBounds, selection, showCaret, text
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classNavigationActions.SelectionPolicyIndicates how to treat selection when caret is moved.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voiddeselect()Clears the selection while keeping the caret position.default voidend(NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the end of the text.default voidmoveTo(int pos)Moves the caret to the given position in the text and clears any selection.default voidmoveTo(int paragraphIndex, int columnIndex)Moves the caret to the position returned fromgetAbsolutePosition(paragraphIndex, columnIndex)and clears any selection.default voidmoveTo(int paragraphIndex, int columnIndex, NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the position returned fromgetAbsolutePosition(paragraphIndex, columnIndex)using the given selection policy.default voidmoveTo(int position, NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the given position.default voidnextChar(NavigationActions.SelectionPolicy selectionPolicy)Moves the caret forward one char in the text.default voidparagraphEnd(NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the end of the current paragraph.default voidparagraphStart(NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the beginning of the current paragraph.default voidpreviousChar(NavigationActions.SelectionPolicy selectionPolicy)Moves the caret backward one char in the text.default voidselectAll()Selects everything in the area.default voidselectParagraph()Selects the current paragraph.default voidselectWord()Selects the word closest to the caretdefault voidstart(NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the beginning of the text.default voidwordBreaksBackwards(int n, NavigationActions.SelectionPolicy selectionPolicy)Skips n number of word boundaries backwards.default voidwordBreaksForwards(int n, NavigationActions.SelectionPolicy selectionPolicy)Skips n number of word boundaries forward.-
Methods inherited from interface org.fxmisc.richtext.TextEditingArea
anchorProperty, beingUpdatedProperty, caretBoundsProperty, caretColumnProperty, caretPositionProperty, createMultiChange, createMultiChange, currentParagraphProperty, displaceCaret, dispose, getAbsolutePosition, getAnchor, getCaretBounds, getCaretColumn, getCaretPosition, getCaretSelectionBind, getContent, getCurrentParagraph, getDocument, getLength, getLocale, getParagraph, getParagraphLength, getParagraphs, getParagraphSelection, getParagraphSelection, getSegOps, getSelectedText, getSelection, getSelectionBounds, getShowCaret, getText, getText, getText, getText, getText, isBeingUpdated, lengthProperty, multiPlainChanges, multiRichChanges, plainTextChanges, replace, replace, replace, replace, replace, replace, replaceText, replaceText, replaceText, richChanges, selectedTextProperty, selectionBoundsProperty, selectionProperty, selectRange, selectRange, setShowCaret, showCaretProperty, subDocument, subDocument, subDocument, subDocument, textProperty
-
-
-
-
Method Detail
-
moveTo
default void moveTo(int pos)
Moves the caret to the given position in the text and clears any selection.
-
moveTo
default void moveTo(int paragraphIndex, int columnIndex)Moves the caret to the position returned fromgetAbsolutePosition(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
TextEditingArea.getAbsolutePosition(int, int)to know how the column index argument can affect the returned position.- Parameters:
paragraphIndex- the index of the paragraph to which to move the caretcolumnIndex- the index to the left of which to move the caret
- calling
-
moveTo
default void moveTo(int position, NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the given position.
-
moveTo
default void moveTo(int paragraphIndex, int columnIndex, NavigationActions.SelectionPolicy selectionPolicy)Moves the caret to the position returned fromgetAbsolutePosition(paragraphIndex, columnIndex)using the given selection policy.Caution: see
TextEditingArea.getAbsolutePosition(int, int)to know how the column index argument can affect the returned position.
-
previousChar
default void previousChar(NavigationActions.SelectionPolicy selectionPolicy)
Moves the caret backward one char in the text.
-
nextChar
default void nextChar(NavigationActions.SelectionPolicy selectionPolicy)
Moves the caret forward one char in the text.
-
wordBreaksBackwards
default void wordBreaksBackwards(int n, NavigationActions.SelectionPolicy selectionPolicy)Skips n number of word boundaries backwards.
-
wordBreaksForwards
default void wordBreaksForwards(int n, NavigationActions.SelectionPolicy selectionPolicy)Skips n number of word boundaries forward.
-
selectWord
default void selectWord()
Selects the word closest to the caret
-
paragraphStart
default void paragraphStart(NavigationActions.SelectionPolicy selectionPolicy)
Moves the caret to the beginning of the current paragraph.
-
paragraphEnd
default void paragraphEnd(NavigationActions.SelectionPolicy selectionPolicy)
Moves the caret to the end of the current paragraph.
-
start
default void start(NavigationActions.SelectionPolicy selectionPolicy)
Moves the caret to the beginning of the text.
-
end
default void end(NavigationActions.SelectionPolicy selectionPolicy)
Moves the caret to the end of the text.
-
selectParagraph
default void selectParagraph()
Selects the current paragraph.
-
selectAll
default void selectAll()
Selects everything in the area.
-
deselect
default void deselect()
Clears the selection while keeping the caret position.
-
-