java.awt
public class MenuBar extends MenuComponent implements MenuContainer, Serializable, Accessible
Nested Class Summary | |
---|---|
protected class | MenuBar.AccessibleAWTMenuBar
This class provides accessibility support for AWT menu bars.
|
Constructor Summary | |
---|---|
MenuBar()
Initializes a new instance of MenuBar .
|
Method Summary | |
---|---|
Menu | add(Menu menu)
Add a menu to this MenuBar. |
void | addNotify()
Creates this object's native peer. |
int | countMenus()
Returns the number of elements in this menu bar.
|
void | deleteShortcut(MenuShortcut shortcut)
Deletes the specified menu shortcut.
|
AccessibleContext | getAccessibleContext()
Gets the AccessibleContext associated with this MenuBar .
|
Menu | getHelpMenu()
Returns the help menu for this menu bar. |
Menu | getMenu(int index)
Returns the menu at the specified index.
|
int | getMenuCount()
Returns the number of elements in this menu bar.
|
MenuItem | getShortcutMenuItem(MenuShortcut shortcut)
Returns the menu item for the specified shortcut, or null
if no such item exists.
|
void | remove(int index)
Removes the menu at the specified index.
|
void | remove(MenuComponent menu)
Removes the specified menu from the menu bar.
|
void | removeNotify()
Destroys this object's native peer. |
void | setHelpMenu(Menu menu)
Sets the help menu for this menu bar.
|
Enumeration<MenuShortcut> | shortcuts()
Returns a list of all shortcuts for the menus in this menu bar.
|
MenuBar
.
Throws: HeadlessException if GraphicsEnvironment.isHeadless() is true
Parameters: menu the menu to add
Returns: the menu that was added
Deprecated: This method is deprecated in favor of
getMenuCount()
.
Returns: the number of elements in the menu bar
Parameters: shortcut the shortcut to delete
MenuBar
.
The context is created, if necessary.
Returns: the associated context
null
.
Returns: the help menu for this menu bar
Parameters: index the index of the menu
Returns: the requested menu
Throws: ArrayIndexOutOfBoundsException if the index is not valid
Returns: the number of elements in the menu bar
null
if no such item exists.
Parameters: shortcut the shortcut to return the menu item for
Returns: the menu item for the specified shortcut
Parameters: index the index of the menu to remove from the menu bar
Parameters: menu the menu to remove from the menu bar
Parameters: menu the new help menu for this menu bar
Returns: a list of all shortcuts for the menus in this menu bar