Skip navigation links
oracle.ide.controls
Class ButtonKeyController
java.lang.Object
javax.swing.AbstractAction
oracle.ide.controls.ButtonKeyController
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
- Direct Known Subclasses:
- RadioKeyController
-
public class ButtonKeyController
- extends javax.swing.AbstractAction
ButtonKeyController is a utility class that adds keyboard navigation to buttons.
For example: with the following code, the user will be able to navigate between the 3 checkboxes using the up/down keys
JCheckBox checkBox1 = new JCheckBox("Match Case");
JCheckBox checkBox2 = new JCheckBox("Whole Word");
JCheckBox checkBox3 = new JCheckBox("Wrap Around");
ButtonKeyController.attach(checkBox1, checkBox2, checkBox3);
...
- See Also:
- Serialized Form
Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary |
protected |
ButtonKeyController(javax.swing.AbstractButton[] buttons, int direction)
|
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent e)
This is a private implementation method. |
static void |
attach(javax.swing.AbstractButton... buttons)
Adds the keyboard navigation to those buttons. |
protected static void |
attach(ButtonKeyController upAction, ButtonKeyController downAction, javax.swing.AbstractButton[] buttons)
Adds the KeyControllers to the button maps. |
protected int |
getActivedButton(javax.swing.AbstractButton[] buttons)
|
protected void |
setActiveButton(javax.swing.AbstractButton button)
Activates the button |
Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ButtonKeyController
protected ButtonKeyController(javax.swing.AbstractButton[] buttons,
int direction)
attach
public static void attach(javax.swing.AbstractButton... buttons)
- Adds the keyboard navigation to those buttons.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- This is a private implementation method.
attach
protected static void attach(ButtonKeyController upAction,
ButtonKeyController downAction,
javax.swing.AbstractButton[] buttons)
- Adds the KeyControllers to the button maps.
-
- Parameters:
upAction
-
downAction
-
buttons
-
getActivedButton
protected int getActivedButton(javax.swing.AbstractButton[] buttons)
-
- Returns:
- the position of the active button.
setActiveButton
protected void setActiveButton(javax.swing.AbstractButton button)
- Activates the button
Skip navigation links
Copyright © 1997, 2015, Oracle. All rights reserved.