frame.addKeyListener(new KeyListener() {
public @Override void keyPressed(KeyEvent arg0) {
Action act = keyToActionMap.get(arg0.getKeyCode());
if (act != null)
act.actionPerformed(null);
}
public @Override void keyReleased(@SuppressWarnings("unused") KeyEvent arg0)
{// we handle a combined event (keyPressed) instead
}