StyledDocument's paragraph style; only necessary when using the "selectedDocument"
getter or property
StyledDocument's segment type; only necessary when using the "selectedDocument"
getter or property
StyledDocument's segment style; only necessary when using the "selectedDocument"
getter or property
selectRangeExpl(int, int),
selectRange(int, int, int, int)) will move the caret in the same call, except if one uses
displaceSelection(int, int). Updating the selection via any method with an "update" prefix from
Selection will also move the caret if it has been displaced or the anchor is
not the boundary (i.e. the selection's the start or end position) that is being updated.
Likewise, moving the caret via the "move" prefix methods from Caret
will clear the selection in the same call, except if one uses displaceCaret(int).
"Position" refers to the place in-between characters. In other words, every "|" in
"|t|e|x|t|" is a valid position. There are two kinds of positions used here:
getStartPosition()/getEndPosition(), which refers to a position somewhere in the
entire area's content. It's bounds are 0 <= x <= area.getLength().
getStartColumnPosition()/getEndColumnPosition(), which refers to a position
somewhere in the current paragraph. It's bounds are 0 <= x <= area.getParagraphLength(index).
The selection is typically made using the anchor's position and
the underlying caret's position. Hence, selectRangeExpl(int, int)
is the typical method to use, although selectRange(int, int) can also be used.
For type safety, getSelectedDocument() requires the same generic types from StyledDocument.
This means that one must write a lot of boilerplate for the generics:
CaretSelectionBind<Collection<String>, StyledText<Collection<String>>, Collection<String>> selection.
However, this is only necessary if one is using getSelectedDocument() or
selectedDocumentProperty(). If you are not going to use the "selectedDocument" getter or property,
then just write the much simpler CaretSelectionBind<?, ?, ?> selection.
Caret, Selection
| Modifier and Type | Method and Description |
|---|---|
| public ObservableValue | |
| public ObservableValue | |
| public ObservableValue | |
| public void | deselect()
Redeclares as abstract: org. Clears the selection while keeping the caret position the same. |
| public void | displaceCaret(int position)
Displaces the caret from the selection by positioning only the caret to the new location without
also affecting the selection's |
| public void | displaceSelection(int startPosition, int endPosition)
Displaces the caret from the selection by positioning only the selection to the new location without
also affecting the |
| public int | |
| public int | |
| public int | |
| public CaretNode | |
| public Selection | |
| public void | moveBreaksBackwards(int numOfBreaks, BreakIterator breakIterator)
Redeclares org. Moves the caret backwards by the number of breaks and clears any selection |
| public void | moveBreaksForwards(int numOfBreaks, BreakIterator breakIterator)
Redeclares org. Moves the caret forwards by the number of breaks and clears any selection |
| public default void | moveTo(int position)
Implements org. Moves the caret to the given position in the text and clears any selection. |
| public default void | moveTo(int paragraphIndex, int columnPosition)
Implements org. Moves the caret to the position returned from
|
| public default void | moveTo(int pos, NavigationActions.
Moves the caret to the position indicated by |
| public void | moveTo(int paragraphIndex, int columnIndex, NavigationActions.
Moves the caret to the position returned from
|
| public default void | moveToAreaEnd()
Implements org. Moves the caret to the end of the area and clears any selection |
| public void | |
| public default void | moveToAreaStart()
Overrides default org. Moves the caret to the beginning of the area and clears any selection |
| public void | |
| public default void | moveToNextChar()
Implements org. Moves the caret forward one char in the text and clears any selection |
| public void | moveToNextChar(NavigationActions.
Moves the caret forward one char in the text. |
| public default void | moveToParEnd()
Implements org. Moves the caret to the end of the current paragraph and clears any selection |
| public void | |
| public default void | moveToParStart()
Implements org. Moves the caret to the beginning of the current paragraph and clears any selection |
| public void | |
| public default void | moveToPrevChar()
Implements org. Moves the caret backward one char in the text and clears any selection |
| public void | moveToPrevChar(NavigationActions.
Moves the caret backward one char in the text. |
| public void | selectAll()
Redeclares org. Selects everything in the area and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end |
| public void | selectParagraph(int paragraphIndex)
Redeclares org. Selects the given paragraph and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end |
| public default void | |
| public void | selectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition)
Redeclares org. Selects the given range and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end Caution see |
| public void | selectRange(int startPosition, int endPosition)
Redeclares org. Selects the given range and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end |
| public void | selectRangeExpl(int anchorParagraph, int anchorColumn, int caretParagraph, int caretColumn)
Positions the anchor and caretPosition explicitly, effectively creating a selection. |
| public void | selectRangeExpl(int anchorPosition, int caretPosition)
Positions the anchor and caretPosition explicitly, effectively creating a selection. |
| public void | selectWord(int wordPositionInArea)
Redeclares org. Selects the closest word to the given position in the area and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end |
| public default void | |
| public void | updateEndBy(int amount, Selection.
Redeclares org.
|
| public void | updateEndByBreaksBackward(int numOfBreaks, BreakIterator breakIterator)
Redeclares org.
|
| public void | updateEndByBreaksForward(int numOfBreaks, BreakIterator breakIterator)
Redeclares org.
|
| public void | |
| public void | updateEndTo(int paragraphIndex, int columnPosition)
Redeclares org.
|
| public void | updateStartBy(int amount, Selection.
Redeclares org.
|
| public void | updateStartByBreaksBackward(int numOfBreaks, BreakIterator breakIterator)
Redeclares org.
|
| public void | updateStartByBreaksForward(int numOfBreaks, BreakIterator breakIterator)
Redeclares org.
|
| public void | |
| public void | updateStartTo(int paragraphIndex, int columnPosition)
Redeclares org.
|
| anchorColPositionProperty | back to summary |
|---|---|
| public ObservableValue | |
| anchorParIndexProperty | back to summary |
|---|---|
| public ObservableValue | |
| anchorPositionProperty | back to summary |
|---|---|
| public ObservableValue | |
| deselect | back to summary |
|---|---|
| public void deselect() Redeclares as abstract: org. Clears the selection while keeping the caret position the same.
| |
| displaceCaret | back to summary |
|---|---|
| public void displaceCaret(int position) Displaces the caret from the selection by positioning only the caret to the new location without
also affecting the selection's | |
| displaceSelection | back to summary |
|---|---|
| public void displaceSelection(int startPosition, int endPosition) Displaces the caret from the selection by positioning only the selection to the new location without
also affecting the | |
| getAnchorColPosition | back to summary |
|---|---|
| public int getAnchorColPosition() | |
| getAnchorParIndex | back to summary |
|---|---|
| public int getAnchorParIndex() | |
| getAnchorPosition | back to summary |
|---|---|
| public int getAnchorPosition() | |
| getUnderlyingCaret | back to summary |
|---|---|
| public CaretNode getUnderlyingCaret() | |
| getUnderlyingSelection | back to summary |
|---|---|
| public Selection | |
| moveBreaksBackwards | back to summary |
|---|---|
| public void moveBreaksBackwards(int numOfBreaks, BreakIterator breakIterator) Redeclares org. Moves the caret backwards by the number of breaks and clears any selection
| |
| moveBreaksForwards | back to summary |
|---|---|
| public void moveBreaksForwards(int numOfBreaks, BreakIterator breakIterator) Redeclares org. Moves the caret forwards by the number of breaks and clears any selection
| |
| moveTo | back to summary |
|---|---|
| public default void moveTo(int position) Implements org. Moves the caret to the given position in the text and clears any selection.
| |
| moveTo | back to summary |
|---|---|
| public default void moveTo(int paragraphIndex, int columnPosition) Implements org. Moves the caret to the position returned from
| |
| moveTo | back to summary |
|---|---|
| public default void moveTo(int pos, NavigationActions. Moves the caret to the position indicated by | |
| moveTo | back to summary |
|---|---|
| public void moveTo(int paragraphIndex, int columnIndex, NavigationActions. Moves the caret to the position returned from
| |
| moveToAreaEnd | back to summary |
|---|---|
| public default void moveToAreaEnd() Implements org. Moves the caret to the end of the area and clears any selection
| |
| moveToAreaEnd | back to summary |
|---|---|
| public void moveToAreaEnd(NavigationActions. | |
| moveToAreaStart | back to summary |
|---|---|
| public default void moveToAreaStart() Overrides default org. Moves the caret to the beginning of the area and clears any selection
| |
| moveToAreaStart | back to summary |
|---|---|
| public void moveToAreaStart(NavigationActions. | |
| moveToNextChar | back to summary |
|---|---|
| public default void moveToNextChar() Implements org. Moves the caret forward one char in the text and clears any selection
| |
| moveToNextChar | back to summary |
|---|---|
| public void moveToNextChar(NavigationActions. Moves the caret forward one char in the text. Based on the given selection policy, anchor either moves with the caret, stays put, or moves to the former caret position. | |
| moveToParEnd | back to summary |
|---|---|
| public default void moveToParEnd() Implements org. Moves the caret to the end of the current paragraph and clears any selection
| |
| moveToParEnd | back to summary |
|---|---|
| public void moveToParEnd(NavigationActions. | |
| moveToParStart | back to summary |
|---|---|
| public default void moveToParStart() Implements org. Moves the caret to the beginning of the current paragraph and clears any selection
| |
| moveToParStart | back to summary |
|---|---|
| public void moveToParStart(NavigationActions. | |
| moveToPrevChar | back to summary |
|---|---|
| public default void moveToPrevChar() Implements org. Moves the caret backward one char in the text and clears any selection
| |
| moveToPrevChar | back to summary |
|---|---|
| public void moveToPrevChar(NavigationActions. Moves the caret backward one char in the text. Based on the given selection policy, anchor either moves with the caret, stays put, or moves to the former caret position. | |
| selectAll | back to summary |
|---|---|
| public void selectAll() Redeclares org. Selects everything in the area and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end
| |
| selectParagraph | back to summary |
|---|---|
| public void selectParagraph(int paragraphIndex) Redeclares org. Selects the given paragraph and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end
| |
| selectParagraph | back to summary |
|---|---|
| public default void selectParagraph() | |
| selectRange | back to summary |
|---|---|
| public void selectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition) Redeclares org. Selects the given range and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end Caution see
| |
| selectRange | back to summary |
|---|---|
| public void selectRange(int startPosition, int endPosition) Redeclares org. Selects the given range and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end
| |
| selectRangeExpl | back to summary |
|---|---|
| public void selectRangeExpl(int anchorParagraph, int anchorColumn, int caretParagraph, int caretColumn) Positions the anchor and caretPosition explicitly, effectively creating a selection. | |
| selectRangeExpl | back to summary |
|---|---|
| public void selectRangeExpl(int anchorPosition, int caretPosition) Positions the anchor and caretPosition explicitly, effectively creating a selection. | |
| selectWord | back to summary |
|---|---|
| public void selectWord(int wordPositionInArea) Redeclares org. Selects the closest word to the given position in the area and moves the caret to either the start of the new selection if the anchor was equal to the original start or the end if the anchor was equal to the original end
| |
| selectWord | back to summary |
|---|---|
| public default void selectWord() Selects the word closest to the caret | |
| updateEndBy | back to summary |
|---|---|
| public void updateEndBy(int amount, Selection. Redeclares org.
| |
| updateEndByBreaksBackward | back to summary |
|---|---|
| public void updateEndByBreaksBackward(int numOfBreaks, BreakIterator breakIterator) Redeclares org.
| |
| updateEndByBreaksForward | back to summary |
|---|---|
| public void updateEndByBreaksForward(int numOfBreaks, BreakIterator breakIterator) Redeclares org.
| |
| updateEndTo | back to summary |
|---|---|
| public void updateEndTo(int position) Redeclares org.
| |
| updateEndTo | back to summary |
|---|---|
| public void updateEndTo(int paragraphIndex, int columnPosition) Redeclares org.
| |
| updateStartBy | back to summary |
|---|---|
| public void updateStartBy(int amount, Selection. Redeclares org.
| |
| updateStartByBreaksBackward | back to summary |
|---|---|
| public void updateStartByBreaksBackward(int numOfBreaks, BreakIterator breakIterator) Redeclares org.
| |
| updateStartByBreaksForward | back to summary |
|---|---|
| public void updateStartByBreaksForward(int numOfBreaks, BreakIterator breakIterator) Redeclares org.
| |
| updateStartTo | back to summary |
|---|---|
| public void updateStartTo(int position) Redeclares org.
| |
| updateStartTo | back to summary |
|---|---|
| public void updateStartTo(int paragraphIndex, int columnPosition) Redeclares org.
| |