Menu Shortcuts

Menu shortcuts provide the ability to activate a menu item by using the keyboard. Menu shortcuts are also known as menu accelerators or keyboard equivalents. Shortcuts have a key modifier that varies among between platforms:

  • Macintosh: <Command>

  • Windows 95: <Control>

  • Motif: <Control>

The java.awt.Toolkit class provides a method that returns the appropriate modifier—Toolkit.getMenuShortcutKeyMask()—should you ever have the need to programmatically determine the modifier key on a particular platform.

Menu items must provide some kind of visual indication that a shortcut may be used to activate the menu item, when applicable. Such visual indication varies among between platforms and is handled in a platform-dependent manner by the AWT. ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.