MenuBar (Java Platform SE 8 ) (original) (raw)


public class MenuBar
extends MenuComponent
implements MenuContainer, Accessible
The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame. In order to associate the menu bar with a Frame object, call the frame's setMenuBar method.
This is what a menu bar might look like:
Diagram of MenuBar containing 2 menus: Examples and Options.  
 Examples menu is expanded showing items: Basic, Simple, Check, and More Examples.
A menu bar handles keyboard shortcuts for menu items, passing them along to its child menus. (Keyboard shortcuts, which are optional, provide the user with an alternative to the mouse for invoking a menu item and the action that is associated with it.) Each menu item can maintain an instance of MenuShortcut. The MenuBar class defines several methods,shortcuts() andgetShortcutMenuItem(java.awt.MenuShortcut) that retrieve information about the shortcuts a given menu bar is managing.
Since:
JDK1.0
See Also:
Frame, Frame.setMenuBar(java.awt.MenuBar), Menu, MenuItem, MenuShortcut, Serialized Form

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.