public class SpecificCaretPositionListeners extends Object
Constructor and Description |
---|
SpecificCaretPositionListeners() |
Modifier and Type | Method and Description |
---|---|
static void |
setListeners(JTextComponent component)
Adds three listeners to a JTextComponent component:
- A FocusListener -> if this component loses its focus -> set caret position to 0
- A DocumentListener -> if this component doesn't have the focus and its caret position has changed -> set caret position to 0
- A CaretListener -> sometimes DocumentListener doesn't take effect, but this listener does
|
public static void setListeners(JTextComponent component)
component
-