|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.MenuComponent | +--java.awt.MenuItem | +--java.awt.Menu
A Menu that is a component of a menu bar.
Constructor Summary | |
Menu(String label)
Constructs a new Menu with the specified label. |
|
Menu(String label,
boolean tearOff)
Constructs a new Menu with the specified label. |
Method Summary | |
MenuItem |
add(MenuItem mi)
Adds the specified item to this menu. |
void |
add(String label)
Adds an item with with the specified label to this menu. |
void |
addNotify()
Creates the menu's peer. |
void |
addSeparator()
Adds a separator line, or a hypen, to the menu at the current position. |
int |
countItems()
Returns the number of elements in this menu. |
MenuItem |
getItem(int index)
Returns the item located at the specified index of this menu. |
boolean |
isTearOff()
Returns true if this is a tear-off menu. |
void |
remove(int index)
Deletes the item from this menu at the specified index. |
void |
remove(MenuComponent item)
Deletes the specified item from this menu. |
void |
removeNotify()
Removes the menu's peer. |
Methods inherited from class java.awt.MenuItem |
disable, enable, enable, getLabel, isEnabled, paramString, setLabel |
Methods inherited from class java.awt.MenuComponent |
getFont, getParent, getPeer, postEvent, setFont, 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 Menu(String label)
label
- the label to be added to this menupublic Menu(String label, boolean tearOff)
label
- the label to be added to this menutearOff
- the boolean indicating whether or not the menu will be
able to be torn off.Method Detail |
public void addNotify()
addNotify
in class MenuItem
public void removeNotify()
removeNotify
in class MenuComponent
public boolean isTearOff()
public int countItems()
public MenuItem getItem(int index)
index
- the position of the item to be returnedpublic MenuItem add(MenuItem mi)
mi
- the item to be addedpublic void add(String label)
label
- the text on the itempublic void addSeparator()
public void remove(int index)
index
- the position of the item to be removedpublic void remove(MenuComponent item)
remove
in interface MenuContainer
item
- the item to be removed from the menu
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |