| |
|
| 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,Accessible(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.85, 05/05/07 author: Sami Shaio See Also: java.awt.MenuItem See Also: java.awt.CheckboxMenuItem since: JDK1.0 |
Inner Class :protected class AccessibleAWTMenu extends AccessibleAWTMenuItem | |
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 .
|
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: Menu.isTearOff() |
Menu | public Menu(String label, boolean tearOff) throws HeadlessException(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. exception: HeadlessException - if GraphicsEnvironment.isHeadless()returns true. See Also: java.awt.GraphicsEnvironment.isHeadless 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) | | |
countItemsImpl | final int countItemsImpl()(Code) | | |
getAccessibleChildIndex | int getAccessibleChildIndex(MenuComponent child)(Code) | | Defined in MenuComponent. Overridden here.
|
getAccessibleContext | public AccessibleContext getAccessibleContext()(Code) | | Gets the AccessibleContext associated with this Menu.
For menus, the AccessibleContext takes the form of an
AccessibleAWTMenu.
A new AccessibleAWTMenu instance is created if necessary.
an AccessibleAWTMenu that serves as the AccessibleContext of this Menu since: 1.3 |
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) | | Returns a string representing the state of this 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 .
the parameter string of this menu |
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.
|
|
|
|