java.lang.Object | +--java.awt.MenuComponent | +--java.awt.MenuItem | +--java.awt.Menu
Unsafe:
(package private) boolean
isHelpMenu
true
if the Menu in question is actually a help
menu.
(package private) boolean
tearOff
Menu()
Menu(String label,
boolean tearOff)
void
addSeparator()
AccessibleContext
getAccessibleContext()
void
insert(MenuItem menuitem,
int index)
void
insert(String label,
int index)
addActionListener, deleteShortcut, disable, disableEvents, doMenuEvent, enable, enable, enableEvents, eventEnabled, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcut
dispatchEvent, dispatchEventImpl, getAccessibleIndexInParent, getAccessibleStateSet, getFont_NoClientCode, getFont, getName, getParent_NoClientCode, getParent, getPeer, getTreeLock, postEvent, setFont, setName, toString
Vector items
countItems()boolean tearOff
true if the menu has the tear off
property and it will be set to false>
if it does not.
A torn off menu can be deleted by a user when
it is no longer needed.
isTearOff()boolean isHelpMenu
true
if the Menu in question is actually a help
menu. Otherwise it will be set to
false.
private static final String base
private static int nameCounter
private static final long serialVersionUID
private int menuSerializedDataVersion
public Menu() throws HeadlessException
java.awt.GraphicsEnvironment#isHeadlesspublic Menu(String label) throws HeadlessException
label - the menu's label in the menu bar, or in
another menu of which this menu is a submenu.java.awt.GraphicsEnvironment#isHeadlesspublic Menu(String label, boolean tearOff) throws HeadlessException
Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.
label - the menu's label in the menu bar, or in
another menu of which this menu is a submenu.tearOff - if true, the menu
is a tear-off menu.java.awt.GraphicsEnvironment#isHeadlessString constructComponentName()
constructComponentName in class MenuItemMenuComponentpublic void addNotify()
public void removeNotify()
removeNotify in class MenuComponentpublic boolean isTearOff()
Tear-off functionality may not be supported by all implementations of AWT. If a particular implementation doesn't support tear-off menus, this value is silently ignored.
true if this is a tear-off menu;
false otherwise.public int getItemCount()
public int countItems()
getItemCount().
final int countItemsImpl()
public MenuItem getItem(int index)
index - the position of the item to be returned.
final MenuItem getItemImpl(int index)
public MenuItem add(MenuItem mi)
mi - the menu item to be added
java.awt.Menu#insert(java.lang.String, int),
java.awt.Menu#insert(java.awt.MenuItem, int)public void add(String label)
label - the text on the itemjava.awt.Menu#insert(java.lang.String, int),
java.awt.Menu#insert(java.awt.MenuItem, int)public void insert(MenuItem menuitem, int index)
menuitem - the menu item to be inserted.index - the position at which the menu
item should be inserted.java.awt.Menu#add(java.lang.String),
java.awt.Menu#add(java.awt.MenuItem)public void insert(String label, int index)
insert(menuItem, index).
label - the text on the itemindex - the position at which the menu item
should be insertedjava.awt.Menu#add(java.lang.String),
java.awt.Menu#add(java.awt.MenuItem)public void addSeparator()
java.awt.Menu#insertSeparator(int)public void insertSeparator(int index)
index - the position at which the
menu separator should be inserted.java.awt.Menu#addSeparatorpublic void remove(int index)
index - the position of the item to be removed.public void remove(MenuComponent item)
remove in interface MenuContaineritem - the item to be removed from the menu.
If item is null
or is not in this menu, this method does
nothing.public void removeAll()
boolean handleShortcut(KeyEvent e)
handleShortcut in class MenuItemMenuItem getShortcutMenuItem(MenuShortcut s)
getShortcutMenuItem in class MenuItemEnumeration shortcuts()
void deleteShortcut(MenuShortcut s)
deleteShortcut in class MenuItemprivate void writeObject(ObjectOutputStream s) throws IOException
s - the ObjectOutputStream to write
IOExceptionAWTEventMulticaster.save(ObjectOutputStream, String, EventListener),
readObject(java.io.ObjectInputStream)private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException, HeadlessException
ObjectInputStream.
Unrecognized keys or values will be ignored.
s - the ObjectInputStream to read
IOException
ClassNotFoundException
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
writeObject(java.io.ObjectOutputStream)public String paramString()
Menu.
This method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null.
paramString in class MenuItemprivate static void initIDs()
public AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class MenuItem