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()
-
Constructs a new Menu with an empty label.
-
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)
- Adds 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()
-
Deprecated.
-
getItem(int)
- Returns the item located at the specified index of this menu.
-
getItemCount()
-
Returns the number of elements in this menu.
-
insert(MenuItem, int)
- Inserts the MenuItem to this menu at the specified position.
-
insert(String, int)
- Inserts an item with the specified label to this menu
at the specified position.
-
insertSeparator(int)
- Inserts a separator at the specified position
-
isTearOff()
- Returns true if this is a tear-off menu.
-
paramString()
- Returns the String parameter of the menu.
-
remove(int)
- Deletes the item from this menu at the specified index.
-
remove(MenuComponent)
- Deletes the specified item from this menu.
-
removeAll()
- Deletes all items from this menu.
-
removeNotify()
- Removes the menu's peer.
Menu
method Menu() public
- Constructs a new Menu with an empty label. This menu can
not be torn off - the menu will still appear on screen after
the the mouse button has been released.
Menu
method Menu(label=String) public
- Constructs a new Menu with the specified label. This menu can
not be torn off - 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
method Menu(label=String, -
tearOff=boolean) public
- Constructs a new Menu with the specified label. If tearOff is
true, the menu can be torn off - the menu will still appear on
screen after the the mouse button has been released.
NOTE: tear-off functionality may not be supported by all AWT
implementations. If a particular implementation doesn't support
tear-offs, this value will be silently ignored.
- 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
method addNotify() public
- 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
method removeNotify() public
- 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
method isTearOff() returns boolean public
- Returns true if this is a tear-off menu.
NOTE: tear-off functionality may not be supported by all AWT
implementations. If a particular implementation doesn't support
tear-offs, this value will be silently ignored.
getItemCount
method getItemCount() returns int public
- Returns the number of elements in this menu.
countItems
method countItems() returns int public
- Note: countItems() is deprecated.
As of JDK version 1.1,
replaced by getItemCount().
getItem
method getItem(index=int) returns MenuItem public
- Returns the item located at the specified index of this menu.
- Parameters:
- index - the position of the item to be returned
add
method add(mi=MenuItem) returns MenuItem public protect
- Adds the specified item to this menu.
- Parameters:
- mi - the item to be added
add
method add(label=String) public
- Adds an item with with the specified label to this menu.
- Parameters:
- label - the text on the item
insert
method insert(menuitem=MenuItem, -
index=int) public protect
- Inserts the MenuItem to this menu at the specified position.
- Parameters:
- menuitem - the menu item to be inserted
- index - the position at which the menu item should be inserted
- Throws: IllegalArgumentException
- if index is less than 0.
insert
method insert(label=String, -
index=int) public
- Inserts an item with the specified label to this menu
at the specified position.
- Parameters:
- label - the text on the item
- index - the position at which the menu item should be inserted
addSeparator
method addSeparator() public
- Adds a separator line, or a hypen, to the menu at the current position.
insertSeparator
method insertSeparator(index=int) public
- Inserts a separator at the specified position
- Parameters:
- index - the position at which the menu separator should be inserted
- Throws: IllegalArgumentException
- if index is less than 0.
remove
method remove(index=int) public protect
- Deletes the item from this menu at the specified index.
- Parameters:
- index - the position of the item to be removed
remove
method remove(item=MenuComponent) public protect
- Deletes the specified item from this menu.
- Parameters:
- item - the item to be removed from the menu
removeAll
method removeAll() public protect
- Deletes all items from this menu.
paramString
method paramString() returns String public
- Returns the String parameter of the menu.
- Overrides:
- paramString in class MenuItem
All Packages Class Hierarchy This Package Previous Next Index