public class ButtonKeyController
extends javax.swing.AbstractAction
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); ...
Modifier | Constructor and Description |
---|---|
protected |
ButtonKeyController(javax.swing.AbstractButton[] buttons,
int direction) |
Modifier and Type | Method and Description |
---|---|
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
|
protected ButtonKeyController(javax.swing.AbstractButton[] buttons, int direction)
public static void attach(javax.swing.AbstractButton... buttons)
public void actionPerformed(java.awt.event.ActionEvent e)
protected static void attach(ButtonKeyController upAction, ButtonKeyController downAction, javax.swing.AbstractButton[] buttons)
upAction
- downAction
- buttons
- protected int getActivedButton(javax.swing.AbstractButton[] buttons)
protected void setActiveButton(javax.swing.AbstractButton button)