java.lang.Object java.awt.MenuComponent java.awt.MenuBar
public class MenuBar
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:
ALIGN=center HSPACE=10 VSPACE=7>
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.
Frame
, Frame.setMenuBar(java.awt.MenuBar)
, Menu
, MenuItem
, MenuShortcut
, Serialized Form
MenuBar()
dispatchEvent, getFont, getName, getParent, getPeer, getTreeLock, paramString, postEvent, processEvent, setFont, setName, toString
MenuBar
public MenuBar() throws HeadlessException
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true.
GraphicsEnvironment.isHeadless()
public void addNotify()
public void removeNotify()
removeNotify
in class MenuComponent
public Menu getHelpMenu()
public void setHelpMenu(Menu m)
m
- the menu to be set as the help menu
public Menu add(Menu m)
m
- the menu to be added
remove(int)
, remove(java.awt.MenuComponent)
public void remove(int index)
index
- the position of the menu to be removed.
add(java.awt.Menu)
public void remove(MenuComponent m)
remove
in interface MenuContainer
m
- the menu component to be removed.
add(java.awt.Menu)
public int getMenuCount()
@Deprecated public int countMenus()
getMenuCount()
.
public Menu getMenu(int i)
i
- the index position of the menu to be returned.
public Enumeration<MenuShortcut> shortcuts()
MenuShortcut
public MenuItem getShortcutMenuItem(MenuShortcut s)
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.
s
- the specified menu shortcut.
MenuItem
, MenuShortcut
public void deleteShortcut(MenuShortcut s)
s
- the menu shortcut to delete.
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class MenuComponent
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
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