|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.MenuComponent
java.awt.MenuBar
public class MenuBar
This class implements a menu bar in the AWT system.
Nested Class Summary | |
---|---|
protected class |
MenuBar.AccessibleAWTMenuBar
This class provides accessibility support for AWT menu bars. |
Nested classes/interfaces inherited from class java.awt.MenuComponent |
---|
MenuComponent.AccessibleAWTMenuComponent |
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()
Deprecated. This method is deprecated in favor of getMenuCount() . |
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. |
Methods inherited from class java.awt.MenuComponent |
---|
dispatchEvent, getFont, getName, getParent, getPeer, getTreeLock, paramString, postEvent, processEvent, setFont, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Constructor Detail |
---|
public MenuBar()
MenuBar
.
HeadlessException
- if GraphicsEnvironment.isHeadless() is trueMethod Detail |
---|
public Menu getHelpMenu()
null
.
public void setHelpMenu(Menu menu)
menu
- the new help menu for this menu barpublic Menu add(Menu menu)
menu
- the menu to add
public void remove(int index)
index
- the index of the menu to remove from the menu barpublic void remove(MenuComponent menu)
remove
in interface MenuContainer
menu
- the menu to remove from the menu barpublic int getMenuCount()
public int countMenus()
getMenuCount()
.
public Menu getMenu(int index)
index
- the index of the menu
ArrayIndexOutOfBoundsException
- if the index is not validpublic void addNotify()
public void removeNotify()
removeNotify
in class MenuComponent
public Enumeration<MenuShortcut> shortcuts()
public MenuItem getShortcutMenuItem(MenuShortcut shortcut)
null
if no such item exists.
shortcut
- the shortcut to return the menu item for
public void deleteShortcut(MenuShortcut shortcut)
shortcut
- the shortcut to deletepublic AccessibleContext getAccessibleContext()
MenuBar
.
The context is created, if necessary.
getAccessibleContext
in interface Accessible
getAccessibleContext
in class MenuComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |