public void registerKeyboardAction(String command, int key) { panel.registerKeyboardAction( new ControlKeyAction(command), KeyStroke.getKeyStroke(key, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); }