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