- * Global KeyListener
- Görs uppenbarligen så här:
-
- JFrame someFrame = new JFrame();
-
- JComponent rootPane = someFrame.getRootPane();
- ActionMap am = rootPane.getActionMap();
-
- Action helpAction = new AbstractAction() {
- public void actionPerformed(ActionEvent ae) {
- showHelpWindow();
- }};
- am.put("help", helpAction);
-
- InputMap im = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- KeyStroke helpKey = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
- im.put(helpKey, "help");