|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.SelectAllUtils
public class SelectAllUtils
SelectAllUtils
is a utility class to select all the text
in a text component when the component first time receives focus. It's very easy to use it.
JTextField field = new JTextField();
SelectAllUtils.install(field);
The component you pass in can be a JTextComponent or any container that contains
one or more JTextComponents. All JTextComponents will be installed such a
focus listener to select all when it gets focus for the first time. For example,
you can install it to an editable JComboBox.
JComboBox comboBox = new JComboBox();
comboBox.setEditable(true);
SelectAllUtils.install(comboBox);
Although JComboBox is not JTextComponent but it contains a JTextField so it
will still work. However please make sure call it after the call to
comboBox.setEditable(true). Otherwise it will not work because JTextField is not created
until setEditable(true) is called.
Field Summary | |
---|---|
static String |
CLIENT_PROPERTY_ONLYONCE
A client property. |
Constructor Summary | |
---|---|
SelectAllUtils()
|
Method Summary | |
---|---|
static void |
install(Component component)
Installs focus listener to all text components inside the component. |
static void |
install(Component component,
boolean onlyOnce)
Installs focus listener to all text components inside the component. |
static void |
uninstall(Component component)
Uninstalls focus listener to all text components inside the component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CLIENT_PROPERTY_ONLYONCE
Constructor Detail |
---|
public SelectAllUtils()
Method Detail |
---|
public static void install(Component component)
component
- the component to make it select all when having focus. The component could be a JTextComponent or could be
a container that contains one or more JTextComponents. This install method will make all JTextComponents
to have this select all feature.public static void install(Component component, boolean onlyOnce)
component
- the component to make it select all when having focus. The component could be a JTextComponent or could be
a container that contains one or more JTextComponents. This install method will make all JTextComponents
to have this select all feature.onlyOnce
- if true, we will only select all the text when the component has focus for the first time. Otherwise, it will
always select all the text whenever the component receives focus.public static void uninstall(Component component)
component
- the component which install(java.awt.Component)
is called.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |