The arrow keys for this application need to cause press and release events independent of focus. Setting onKeyRelease true causes a release event as expected but setting onKeyRelease false (code below) doesn't seem to stop auto-repeat. Is there a way to implement the key binding to trigger once when the arrow key is pressed and held?
Action right = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
...
}
};
mainPanel.getInputMap(JPanel.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false), "right");
mainPanel.getActionMap().put("right", right);
... could be good question, but please not clear everything, can you please elaborate ...