Interface SelectionModel
- All Known Implementing Classes:
SingleSelectionModel
public interface SelectionModel
SelectionSegment.- Since:
- 24
Property Summary
| Type | Property | Description |
|---|---|---|
ReadOnlyProperty |
anchorPosition |
Anchor position property. |
ReadOnlyProperty |
caretPosition |
Caret position property. |
ReadOnlyProperty |
selection |
Selection property. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
ReadOnlyProperty |
anchorPositionProperty() |
Anchor position property. |
ReadOnlyProperty |
caretPositionProperty() |
Caret position property. |
void |
clear() |
Clears the selection. |
void |
extendSelection |
Extends selection to the specified position. |
SelectionSegment |
getSelection() |
Returns the current selection. |
ReadOnlyProperty |
selectionProperty() |
Selection property. |
void |
setSelection |
Replaced existing selection, if any, with the new one. |
Property Details
caretPosition
ReadOnlyProperty<TextPos> caretPositionProperty
null, the selectionProperty and the anchorPositionProperty are also null. Note: selectionProperty(), anchorPositionProperty(), and caretPositionProperty() are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.
- Default value:
- null
- See Also:
anchorPosition
ReadOnlyProperty<TextPos> anchorPositionProperty
null, the selectionProperty and the caretPositionProperty are also null. Note: selectionProperty(), anchorPositionProperty(), and caretPositionProperty() are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.
- Default value:
- null
- See Also:
selection
ReadOnlyProperty<SelectionSegment> selectionProperty
null, the anchorPositionProperty and the caretPositionProperty are also null.- Default value:
- null
- See Also:
Method Details
clear
void clear()
selectionProperty, anchorPositionProperty, and caretPositionProperty to null.setSelection
void setSelection(StyledTextModel model, TextPos anchor, TextPos caret)
anchorPositionProperty, and caretPositionProperty must always remain within the valid range for the document.- Parameters:
-
model- the model, must be non-null -
anchor- the anchor position, must be non-null -
caret- the caret position, must be non-null
extendSelection
void extendSelection(StyledTextModel model, TextPos pos)
setSelection(model, pos, pos) call if the model instance is different from that passed before. While this method will accept the text position outside of the document range, the actual values of anchorPositionProperty, and caretPositionProperty must always remain within the valid range for the document.
- Parameters:
-
model- the model, must be non-null -
pos- the new caret position, must be non-null
caretPositionProperty
ReadOnlyProperty<TextPos> caretPositionProperty()
null, the selectionProperty and the anchorPositionProperty are also null. Note: selectionProperty(), anchorPositionProperty(), and caretPositionProperty() are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.
- Default value:
- null
- Returns:
- the caret position property
anchorPositionProperty
ReadOnlyProperty<TextPos> anchorPositionProperty()
null, the selectionProperty and the caretPositionProperty are also null. Note: selectionProperty(), anchorPositionProperty(), and caretPositionProperty() are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.
- Default value:
- null
- Returns:
- the anchor position property
selectionProperty
ReadOnlyProperty<SelectionSegment> selectionProperty()
null, the anchorPositionProperty and the caretPositionProperty are also null.- Default value:
- null
- Returns:
- the selection property
- See Also:
getSelection
SelectionSegment getSelection()
null, the anchorPositionProperty and the caretPositionProperty are also null.- Returns:
- current selection, or null
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.