Package com.jidesoft.swing
Class ArrowKeyNavigationSupport
- java.lang.Object
-
- com.jidesoft.swing.ArrowKeyNavigationSupport
-
public class ArrowKeyNavigationSupport extends java.lang.Object
This is a util class to support the four arrow keys navigation in any container. To use it, you can call
The container could be any container. A typical use case is the button panel. By default we used it innew ArrowKeyNavigationSupport().install(container);
ButtonPanel
class to enable left/right/up/down key. By default, all components will be navigable in the container but you can further define what components are navigable by using the constructor
where componentTypes is the list of the classes of the components that you would like to be navigable. For example,new ArrowKeyNavigationSupport(Class[] componentTypes)
to only allow any buttons (JButton, JideButton, JCheckBox, JRadioButton) etc. You can also allow certain keys to be used. For example.new ArrowKeyNavigationSupport(new Class[]{ AbstractButton.class }).install(container);
if only left and right keys are making sense to navigate in your container.new ArrowKeyNavigationSupport(new int[]{ KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT}).install(container);
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLIENT_PROPERTY_ARROWKEY_NAVIGATION_SUPPORT
-
Constructor Summary
Constructors Constructor Description ArrowKeyNavigationSupport()
ArrowKeyNavigationSupport(int[] keyCodes)
ArrowKeyNavigationSupport(java.lang.Class[] componentTypes)
ArrowKeyNavigationSupport(java.lang.Class[] componentTypes, int[] keyCode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
install(javax.swing.JComponent container)
Installs the actions for arrow keys to allow user to navigate components using arrow keys.void
uninstall(javax.swing.JComponent container)
Uninstalls the actions for arrow keys.
-
-
-
Field Detail
-
CLIENT_PROPERTY_ARROWKEY_NAVIGATION_SUPPORT
public static final java.lang.String CLIENT_PROPERTY_ARROWKEY_NAVIGATION_SUPPORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ArrowKeyNavigationSupport
public ArrowKeyNavigationSupport()
-
ArrowKeyNavigationSupport
public ArrowKeyNavigationSupport(java.lang.Class[] componentTypes)
-
ArrowKeyNavigationSupport
public ArrowKeyNavigationSupport(int[] keyCodes)
-
ArrowKeyNavigationSupport
public ArrowKeyNavigationSupport(java.lang.Class[] componentTypes, int[] keyCode)
-
-
Method Detail
-
install
public void install(javax.swing.JComponent container)
Installs the actions for arrow keys to allow user to navigate components using arrow keys.- Parameters:
container
- the container such as ButtonPanel, JPanel etc.
-
uninstall
public void uninstall(javax.swing.JComponent container)
Uninstalls the actions for arrow keys.- Parameters:
container
- the container such as ButtonPanel, JPanel etc.
-
-