I would like to have 2 buttons:
1) BindBTN - When clicked a keyListener/action will listen for key press and find the KeyCode of that key.
2) RunBTN - When clicked an action will wait until the user presses the same key and then preforms runProgram()
RunBTN.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@SuppressWarnings("serial")
AbstractAction run = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
runProgram();
}
};
RunBTN.getInputMap().put(KeyStroke.getKeyStroke("**bound key**"),
"run");
RunBTN.getActionMap().put("run",
run);
}
});
What should i do for BindBTN?