Class java.awt.Menu
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Menu
java.lang.Object
|
+----java.awt.MenuComponent
|
+----java.awt.MenuItem
|
+----java.awt.Menu
- public class Menu
- extends MenuItem
- implements MenuContainer
A Menu that is a component of a menu bar.
-
Menu(String)
-
Constructs a new Menu with the specified label.
-
Menu(String, boolean)
-
Constructs a new Menu with the specified label.
-
add(MenuItem)
- Adds the specified item to this menu.
-
add(String)
- Add an item with with the specified label to this menu.
-
addNotify()
- Creates the menu's peer.
-
addSeparator()
- Adds a separator line, or a hypen, to the menu at the current position.
-
countItems()
-
Returns the number of elements in this menu.
-
getItem(int)
- Returns the item located at the specified index of this menu.
-
isTearOff()
- Returns true if this is a tear-off menu.
-
remove(int)
- Deletes the item at the specified index from this menu.
-
remove(MenuComponent)
- Deletes the specified item from this menu.
-
removeNotify()
- Removes the menu's peer.
Menu
public Menu(String label)
- Constructs a new Menu with the specified label. This menu will not
be able to be torn off. Torn off means that the menu will
still appear on screen after the the mouse button has been released.
- Parameters:
- label - the label to be added to this menu
Menu
public Menu(String label,
boolean tearOff)
- Constructs a new Menu with the specified label. The menu will be able
to be torn off if tearOff is true. Torn off means that the menu will
still appear on screen after the the mouse button has been released.
- Parameters:
- label - the label to be added to this menu
- tearOff - the boolean indicating whether or not the menu will be
able to be torn off.
addNotify
public synchronized void addNotify()
- Creates the menu's peer. The peer allows us to modify the
appearance of the menu without changing its functionality.
- Overrides:
- addNotify in class MenuItem
removeNotify
public synchronized void removeNotify()
- Removes the menu's peer. The peer allows us to modify the appearance
of the menu without changing its functionality.
- Overrides:
- removeNotify in class MenuComponent
isTearOff
public boolean isTearOff()
- Returns true if this is a tear-off menu. Torn off means that the menu
will still appear on screen after the the mouse button has been
released.
countItems
public int countItems()
- Returns the number of elements in this menu.
getItem
public MenuItem getItem(int index)
- Returns the item located at the specified index of this menu.
- Parameters:
- index - the position of the item to be returned
add
public synchronized MenuItem add(MenuItem mi)
- Adds the specified item to this menu.
- Parameters:
- mi - the item to be added
add
public void add(String label)
- Add an item with with the specified label to this menu.
- Parameters:
- label - the text on the item
addSeparator
public void addSeparator()
- Adds a separator line, or a hypen, to the menu at the current position.
remove
public synchronized void remove(int index)
- Deletes the item at the specified index from this menu.
- Parameters:
- index - the position of the item to be removed
remove
public synchronized void remove(MenuComponent item)
- Deletes the specified item from this menu.
- Parameters:
- item - the item to be removed from the menu
All Packages Class Hierarchy This Package Previous Next Index