A popup menu — a list of items, separators and submenus.
A window menu bar — the horizontal strip of top-level menus.
The kind of a menu item.
Dispatch a menu or accelerator command to its item's onClicked.
Generate a unique menu command id (used when an item is appended with id 0).
Parse an accelerator string such as "Ctrl+Shift+N" or "F5".
Show menu as a context menu owned by parent.
Result of parsing an accelerator string.
One menu command.
Menu system: menu bars, popup menus, menu items and keyboard accelerators.
A MenuItem is a lightweight value describing one command (id, label, optional accelerator such as "Ctrl+N", and an onClicked event). Menu wraps a native popup HMENU; MenuBar wraps a window menu HMENU and is attached to a Window via Window.setMenuBar.
Menu and accelerator commands both arrive as WM_COMMAND with a null lParam; Window routes them here through dispatchMenuCommand, which fires the matching item's onClicked. Accelerators are collected from every item carrying an accelerator string into a single HACCEL table that the message loop feeds to TranslateAccelerator.
The native menus provide MSAA accessibility for free: screen readers announce menu names, item labels, accelerator text, and checked/disabled state.