JTextField ( focus ) et Key Bindings
Bonjour,
Lorsque le focus est en dehors de tout JTextField, le key binding marche, par contre dans un JTextField le left & right ne marche pas
Pourquoi ?
Merci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap actionMap = getRootPane().getActionMap();
inputMap.put(KeyStroke.getKeyStroke("LEFT"), "LEFT");
actionMap.put("LEFT", new MAction("LEFT"));
inputMap.put(KeyStroke.getKeyStroke("RIGHT"), "RIGHT");
actionMap.put("RIGHT", new MAction("RIGHT"));
inputMap.put(KeyStroke.getKeyStroke("UP"), "UP");
actionMap.put("UP", new MAction("UP"));
inputMap.put(KeyStroke.getKeyStroke("DOWN"), "DOWN");
actionMap.put("DOWN", new MAction("DOWN")); |