Am I using the InputMap and the ActionMap correctly?
"Klaus Martinschitz" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
O.K., I did it. I made a mistake. It should look like this... Code: InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_S, 0), "select");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_R, 0), "rotate");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.SHIFT_DOWN_MASK), "rotatePhi1Positive");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK), "rotatePhiPositive");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.ALT_DOWN_MASK), "rotatePhi2Positive");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.SHIFT_DOWN_MASK), "rotatePhi1Negative");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.CTRL_DOWN_MASK), "rotatePhiNegative");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.ALT_DOWN_MASK), "rotatePhi2Negative");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, 0), "zoom");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_1, 0), "selectFirstStereographicaReflexProvider");//NOI18N inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_2, 0), "selectSecondStereographicaReflexProvider");//NOI18N setInputMap(WHEN_IN_FOCUSED_WINDOW, inputMap); I didn't use WHEN_IN_FOCUSED_WINDOW. Now it works. Thanks again for your help. Regards, Klaus