CaretListener (Java Platform SE 8 )
Keywords: javax.swing.event.CaretListener interface
Date: 2026-06-25

javax.swing.event

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

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `caretUpdate(CaretEvent e)` Called when the caret position is updated.

- - ### Method Detail

    - #### caretUpdate

          void caretUpdate(CaretEvent e)

      Called when the caret position is updated.
      Parameters:
        `e` - the caret event

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.