Uses of Interface javax.swing.event.CaretListener (Java Platform SE 8 )
Date: 2026-06-25

## Uses of Interface
javax.swing.event.CaretListener

- Packages that use CaretListener
  Package | Description
  --- | ---
  javax.swing | Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
  javax.swing.text | Provides classes and interfaces that deal with editable and noneditable text components.

- - ### Uses of CaretListener in javax.swing

    Classes in javax.swing that implement CaretListener
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `JEditorPane.AccessibleJEditorPane` This class implements accessibility support for the `JEditorPane` class.
    `protected class` | `JEditorPane.AccessibleJEditorPaneHTML` This class provides support for `AccessibleHypertext`, and is used in instances where the `EditorKit` installed in this `JEditorPane` is an instance of `HTMLEditorKit`.
    `protected class` | `JEditorPane.JEditorPaneAccessibleHypertextSupport` What's returned by `AccessibleJEditorPaneHTML.getAccessibleText`.
    `protected class` | `JPasswordField.AccessibleJPasswordField` This class implements accessibility support for the `JPasswordField` class.
    `protected class` | `JTextArea.AccessibleJTextArea` This class implements accessibility support for the `JTextArea` class.
    `protected class` | `JTextField.AccessibleJTextField` This class implements accessibility support for the `JTextField` class.

  - ### Uses of CaretListener in javax.swing.text

    Classes in javax.swing.text that implement CaretListener
    Modifier and Type | Class and Description
    --- | ---
    `class` | `JTextComponent.AccessibleJTextComponent` This class implements accessibility support for the `JTextComponent` class.

    Methods in javax.swing.text that return CaretListener
    Modifier and Type | Method and Description
    --- | ---
    `CaretListener[]` | JTextComponent.`getCaretListeners()` Returns an array of all the caret listeners registered on this text component.

    Methods in javax.swing.text with parameters of type CaretListener
    Modifier and Type | Method and Description
    --- | ---
    `void` | JTextComponent.`addCaretListener(CaretListener listener)` Adds a caret listener for notification of any changes to the caret.
    `void` | JTextComponent.`removeCaretListener(CaretListener listener)` Removes a caret listener.

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.