I have a program which I want to use keybindings:
// Imports..
public class Test{
JButton button = new JButton();
Test(){
//...
button.getInputMap().put(KeyStroke.getKeyStroke("A"), "A");
button.getActionMap().put("Action", action);
//...
}
}
Now how do I make the button respond when it is clicked?
Is it like KeyListeners where I have an actionPerformed method?
Now how do I make the button respond when it is clicked?
from KeyBindings is there only one way
button.doClick();
then this code line to invoke ActionListener or Swing Action added to the JButton