CaretListener (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.swing.event, interface: CaretListener
Keywords: javax.swing.event.CaretListener interface

# Interface CaretListener

All Superinterfaces:
  `EventListener`

All Known Implementing Classes:
  `JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport, JPasswordField.AccessibleJPasswordField, JTextArea.AccessibleJTextArea, JTextComponent.AccessibleJTextComponent, JTextField.AccessibleJTextField`

public interface CaretListener extends EventListener
Listener for changes in the caret position of a text component.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `caretUpdate(CaretEvent e)`
  Called when the caret position is updated.

- ## Method Details

  - ### caretUpdate

    void caretUpdate(CaretEvent e)
    Called when the caret position is updated.
    Parameters:
      `e` - the caret event