# Class CaretInfo

java.lang.Object
javafx.scene.text.CaretInfo

public abstract sealed class CaretInfo extends Object
Provides the information associated with the caret.

Typically, the caret is represented by a single vertical line which visually indicates the position within the text. In some cases, where the caret is positioned between left-to-right and right-to-left text, two line segments will be shown, indicating the insertion position for both left-to-right and right-to-left character.

Since:
  25

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CaretInfo()`
  Constructor for subclasses to call.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract Rectangle2D`
  `getSegmentAt(int index)`
  Returns the geometry of the segment at the specified index.
  `abstract int`
  `getSegmentCount()`
  Returns the number of segments representing the caret.

  ### Methods declared in class Object

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

- ## Constructor Details

  - ### CaretInfo

    protected CaretInfo()
    Constructor for subclasses to call.

- ## Method Details

  - ### getSegmentCount

    public abstract int getSegmentCount()
    Returns the number of segments representing the caret.
    Returns:
      the number of segments representing the caret

  - ### getSegmentAt

    public abstract Rectangle2D getSegmentAt(int index)
    Returns the geometry of the segment at the specified index.
    Parameters:
      `index` - the line index
    Returns:
      the bounds of the caret segment
    Throws:
      `IndexOutOfBoundsException` - if the index is out of range `(index < 0 || index >= getSegmentCount())`