I'm about to use keybinding in a swing application for the num pad enter key, but the key is difficult to catch.
All examples I have seen rely on something like
key == KeyEvent.VK_KP_LEFT
where VK_KP_LEFT is some predefined value. Other options are to define a keystoke like this:
KeyStroke.getKeyStroke("control A");
KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK);
but I have not found the "modifier" for numpad.
What is easily to obtain is the difference between the general and the numpad-enter:
All numpad-keys (indepently if switched in the numeric mode or not) get assigned the
getKeyLocation() == 4
(I spottetd this from key pressed / key released methods)
The question is:
How to properly prepare the keyStroke for numpad enter key to use it in the
inputMap.put(KeyStroke keyStroke, Object actionMapKey)
key binding method?
Thanks,
Tarik