# 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

  Constructors
  Constructor
  Description
  `SelectionSegment(TextPos anchor, TextPos caret)`
  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.

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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