|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.FocusAdapter
be.ugent.caagt.swirl.SelectOnFocusGained
public class SelectOnFocusGained
Focus listener which automatically selects the contents of a text component when it
gains focus. This is a singleton class without a public constructor.
The shared singleton instance of this class should be used through the
class method register(javax.swing.text.JTextComponent)
.
As an example, the following code creates a text field
textField
and ensures that the contents of the field
will be selected automatically whenever we enter the field (e.g., by tabbing
to it or by moving the focus to it programmatically).
JTextField textField = new JTextField (10); SelectOnFocusGained.register (textField);
Method Summary | |
---|---|
void |
focusGained(java.awt.event.FocusEvent e)
|
static void |
register(javax.swing.text.JTextComponent component)
Registers a shared focus listener of this type with the given component. |
static void |
unregister(javax.swing.text.JTextComponent component)
Unregisters the shared focus listener with the given component. |
Methods inherited from class java.awt.event.FocusAdapter |
---|
focusLost |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void register(javax.swing.text.JTextComponent component)
public static void unregister(javax.swing.text.JTextComponent component)
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
focusGained
in class java.awt.event.FocusAdapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |