Key bindings with multiple keys
问题 I'm using this code to bind keyboard keys to custom actions without using the KeyListener : Action left = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("pressed left key"); } }; Action right = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("pressed right key"); } }; Action space = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("pressed space