| |
|
| java.lang.Object java.awt.MenuComponent java.awt.MenuItem java.awt.Menu
All known Subclasses: java.awt.PopupMenu,
Menu | public class Menu extends MenuItem implements MenuContainer(Code) | | A Menu object is a pull-down menu component
that is deployed from a menu bar.
A menu can optionally be a tear-off menu. A tear-off menu
can be opened and dragged away from its parent menu bar or menu.
It remains on the screen after the mouse button has been released.
The mechanism for tearing off a menu is platform dependent, since
the look and feel of the tear-off menu is determined by its peer.
On platforms that do not support tear-off menus, the tear-off
property is ignored.
Each item in a menu must belong to the MenuItem
class. It can be an instance of MenuItem , a submenu
(an instance of Menu ), or a check box (an instance of
CheckboxMenuItem ).
version: 1.55, 08/19/02 author: Sami Shaio See Also: java.awt.MenuItem See Also: java.awt.MenuBar See Also: java.awt.MenuShortcut See Also: java.awt.CheckboxMenuItem See Also: java.awt.Frame since: JDK1.0 |
Field Summary | |
boolean | isHelpMenu This field will be set to true
if the Menu in question is actually a help
menu. | Vector | items A vector of the items that will be part of the Menu. | boolean | tearOff This field indicates whether the menu has the
tear of property or not. |
Constructor Summary | |
public | Menu() Constructs a new menu with an empty label. | public | Menu(String label) Constructs a new menu with the specified label. | public | Menu(String label, boolean tearOff) Constructs a new menu with the specified label,
indicating whether the menu can be torn off.
Tear-off functionality may not be supported by all
implementations of AWT. |
isHelpMenu | boolean isHelpMenu(Code) | | This field will be set to true
if the Menu in question is actually a help
menu. Otherwise it will be set to
false .
|
items | Vector items(Code) | | A vector of the items that will be part of the Menu.
See Also: countItems() |
tearOff | boolean tearOff(Code) | | This field indicates whether the menu has the
tear of property or not. It will be set to
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.
See Also: isTearOff() |
Menu | public Menu()(Code) | | Constructs a new menu with an empty label. This menu is not
a tear-off menu.
since: JDK1.1 |
Menu | public Menu(String label)(Code) | | Constructs a new menu with the specified label. This menu is not
a tear-off menu.
Parameters: label - the menu's label in the menu bar, or inanother menu of which this menu is a submenu. |
Menu | public Menu(String label, boolean tearOff)(Code) | | Constructs a new menu with the specified label,
indicating whether the menu can be torn off.
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.
Parameters: label - the menu's label in the menu bar, or inanother menu of which this menu is a submenu. Parameters: tearOff - if true , the menuis a tear-off menu. since: JDK1.0. |
addNotify | public void addNotify()(Code) | | Creates the menu's peer. The peer allows us to modify the
appearance of the menu without changing its functionality.
|
constructComponentName | String constructComponentName()(Code) | | Construct a name for this MenuComponent. Called by getName() when
the name is null.
|
countItems | public int countItems()(Code) | | |
getItem | public MenuItem getItem(int index)(Code) | | Gets the item located at the specified index of this menu.
Parameters: index - the position of the item to be returned. the item located at the specified index. |
getItemCount | public int getItemCount()(Code) | | Get the number of items in this menu.
the number of items in this menu. since: JDK1.1 |
insertSeparator | public void insertSeparator(int index)(Code) | | Inserts a separator at the specified position.
Parameters: index - the position at which themenu separator should be inserted. exception: IllegalArgumentException - if the value ofindex is less than 0. See Also: java.awt.Menu.addSeparator since: JDK1.1 |
isTearOff | public boolean isTearOff()(Code) | | Indicates whether this menu is a tear-off menu.
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. |
paramString | public String paramString()(Code) | | Gets the parameter string representing the state of this menu.
This string is useful for debugging.
since: JDK1.0nu. |
remove | public void remove(int index)(Code) | | Removes the menu item at the specified index from this menu.
Parameters: index - the position of the item to be removed. |
remove | public void remove(MenuComponent item)(Code) | | Removes the specified menu item from this menu.
Parameters: item - the item to be removed from the menu. If item is null or is not in this menu, this method does nothing. |
removeAll | public void removeAll()(Code) | | Removes all items from this menu.
since: JDK1.0. |
removeNotify | public void removeNotify()(Code) | | Removes the menu's peer. The peer allows us to modify the appearance
of the menu without changing its functionality.
|
|
|
|