public final class JTextObserver
extends java.lang.Object
implements java.awt.event.FocusListener
Modifier and Type | Field and Description |
---|---|
private static JTextObserver |
singleton
The singleton instance.
|
Modifier | Constructor and Description |
---|---|
private |
JTextObserver()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
addTextComponent(javax.swing.text.JTextComponent t)
Adds this instance as a listener for the specified text component.
|
void |
focusGained(java.awt.event.FocusEvent e)
Selects all the text when a field gains the focus.
|
void |
focusLost(java.awt.event.FocusEvent e)
Deselects the text when a field loses the focus.
|
static JTextObserver |
getInstance()
Returns the single instance.
|
static void |
removeTextComponent(javax.swing.text.JTextComponent t)
Removes this instance as a listener for the specified text component.
|
private static JTextObserver singleton
public static JTextObserver getInstance()
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
e
- the focus event.public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
e
- the event.public static void addTextComponent(javax.swing.text.JTextComponent t)
t
- the text component.public static void removeTextComponent(javax.swing.text.JTextComponent t)
t
- the text component.