GeezerVison is showing docs.oracle.com — MenuBar (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
protected class |
MenuBar.AccessibleAWTMenuBar |
Inner class of MenuBar used to provide default support for
accessibility.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
MenuBar() |
Creates a new menu bar.
|
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods
| Modifier and Type |
Method |
Description |
Menu |
add(Menu m) |
Adds the specified menu to the menu bar.
|
void |
addNotify() |
Creates the menu bar's peer.
|
int |
countMenus() |
Deprecated.
As of JDK version 1.1,
replaced by getMenuCount().
|
void |
deleteShortcut(MenuShortcut s) |
Deletes the specified menu shortcut.
|
AccessibleContext |
getAccessibleContext() |
Gets the AccessibleContext associated with this MenuBar.
|
Menu |
getHelpMenu() |
Gets the help menu on the menu bar.
|
Menu |
getMenu(int i) |
Gets the specified menu.
|
int |
getMenuCount() |
Gets the number of menus on the menu bar.
|
MenuItem |
getShortcutMenuItem(MenuShortcut s) |
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 |
remove(int index) |
Removes the menu located at the specified
index from this menu bar.
|
void |
remove(MenuComponent m) |
Removes the specified menu component from this menu bar.
|
void |
removeNotify() |
Removes the menu bar's peer.
|
void |
setHelpMenu(Menu m) |
Sets the specified menu to be this menu bar's help menu.
|
Enumeration<MenuShortcut> |
shortcuts() |
Gets an enumeration of all menu shortcuts this menu bar
is managing.
|
-
Methods inherited from class java.awt.MenuComponent
dispatchEvent, getFont, getName, getParent, getPeer, getTreeLock, paramString, postEvent, processEvent, setFont, setName, toString
-
-
Method Detail
-
setHelpMenu
public void setHelpMenu(Menu m)
Sets the specified menu to be this menu bar's help menu.
If this menu bar has an existing help menu, the old help menu is
removed from the menu bar, and replaced with the specified menu.
- Parameters:
m - the menu to be set as the help menu
-
getShortcutMenuItem
public MenuItem getShortcutMenuItem(MenuShortcut s)
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.
- Parameters:
s - the specified menu shortcut.
- Since:
- JDK1.1
- See Also:
MenuItem,
MenuShortcut
-
getAccessibleContext
public AccessibleContext getAccessibleContext()
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.
- Specified by:
getAccessibleContext in interface Accessible
- Overrides:
getAccessibleContext in class MenuComponent
- Returns:
- an AccessibleAWTMenuBar that serves as the
AccessibleContext of this MenuBar
- Since:
- 1.3
Java™ Platform Standard Ed. 8
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, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|