MenuContainer
, Serializable
, 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:
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()
and getShortcutMenuItem(java.awt.MenuShortcut)
that retrieve information about the shortcuts a given menu bar is managing.
Nested Classes
protected class
Inner class of MenuBar used to provide default support for accessibility.
Constructors
Adds the specified menu to the menu bar.
void
Creates the menu bar's peer.
int
void
Deletes the specified menu shortcut.
Gets the AccessibleContext associated with this MenuBar.
Gets the help menu on the menu bar.
int
Gets the number of menus on the menu bar.
Gets the instance of MenuItem
associated with the specified MenuShortcut
object, or null
if none of the menu items being managed by this menu bar is associated with the specified menu shortcut.
void
Removes the menu located at the specified index from this menu bar.
void
Removes the specified menu component from this menu bar.
void
Removes the menu bar's peer.
void
Sets the specified menu to be this menu bar's help menu.
Gets an enumeration of all menu shortcuts this menu bar is managing.
dispatchEvent, getFont, getName, getParent, getTreeLock, paramString, postEvent, processEvent, setFont, setName, toString
Creates a new menu bar.
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.
public void addNotify()
Creates the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.
public void removeNotify()
Removes the menu bar's peer. The peer allows us to change the appearance of the menu bar without changing any of the menu bar's functionality.
removeNotify
in class MenuComponent
public void remove(int index)
Removes the menu located at the specified index from this menu bar.
index
- the position of the menu to be removed.
Gets an enumeration of all menu shortcuts this menu bar is managing.
Gets the AccessibleContext associated with this MenuBar. For menu bars, the AccessibleContext takes the form of an AccessibleAWTMenuBar. A new AccessibleAWTMenuBar instance is created if necessary.
getAccessibleContext
in interface Accessible
getAccessibleContext
in class MenuComponent
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4