Menu Accelerators

Scott Palmer swpalmer at
Fri Jan 4 12:29:34 PST 2013

On a JMenuItem I can set an accelerator to be KeyEvent.VK_PLUS with a KeyEvent.CTRL_DOWN_MASK modifier.
When I press CTRL+SHIFT+EQUALS, since the plus sign on a standard US keyboard is obtained by holding SHIFT while pressing the equals key. It works.

If in JavaFX I use an accelerator of new KeyCodeCombination(KeyCode.PLUS, KeyCombination.CTRL_DOWN), then pressing CTRL+SHIFT+EQUALS does not activate the accelerator.  Nor does pressing CTRL+The_Numeric_Keypad_PLUS.  Note that there is no KeyCode specifically for the numeric keypad plus sign as far as I can tell.


If I code the accelerator as CTRL+SHIFT+EQUALS it doesn't convey the same meaning (I'm using this to zoom in) and I worry that it won't make sense on non-US keyboards because the plus sign may be somewhere else.

Interestingly I see KeyCode.KP_UP, KeyCode.KP_DOWN, KeyCode.KP_LEFT, KeyCode.KP_RIGHT in addition to just KeyCode.UP, KeyCode.DOWN, KeyCode.LEFT, KeyCode.RIGHT. The KP_ versions refer to "key pad" arrow keys (for when some weirdo turns off numlock).  So the omission of the / * - + keys that surround the numeric keypad on a standard US keyboard seems to be an oversight.

Is there an issue for this already?


More information about the openjfx-dev mailing list