Class SelectionSegment
java.lang.Object
jfx.incubator.scene.control.richtext.SelectionSegment
public final class SelectionSegment extends Object
Text selection segment, comprised of the selection anchor and the caret positions. The main purpose of this class is to enable tracking of selection changes as a single entity.
- Since:
- 24
Constructor Summary
| Constructor | Description |
|---|---|
SelectionSegment |
Constructs the selection segment. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final TextPos |
getAnchor() |
Returns the selection anchor position. |
final TextPos |
getCaret() |
Returns the caret position. |
TextPos |
getMax() |
Returns the position which is closer to the end of the document. |
final TextPos |
getMin() |
Returns the position which is closer to the start of the document. |
boolean |
isCollapsed() |
Returns true if the anchor and the caret are at the same position. |
Constructor Details
SelectionSegment
public SelectionSegment(TextPos anchor, TextPos caret)
Constructs the selection segment.
- Parameters:
-
anchor- the anchor position, must not be null -
caret- the caret position, must not be null
Method Details
getAnchor
public final TextPos getAnchor()
Returns the selection anchor position.
- Returns:
- the anchor position
getCaret
public final TextPos getCaret()
Returns the caret position.
- Returns:
- the caret position
getMin
public final TextPos getMin()
Returns the position which is closer to the start of the document.
- Returns:
- the text position
getMax
public TextPos getMax()
Returns the position which is closer to the end of the document.
- Returns:
- the text position
isCollapsed
public boolean isCollapsed()
Returns true if the anchor and the caret are at the same position.
- Returns:
- true if the anchor and the caret are at the same position
© 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.