java.awt

Class Menu

  • All Implemented Interfaces:
    MenuContainer, java.io.Serializable, javax.accessibility.Accessible
    Direct Known Subclasses:
    PopupMenu
    public class Menu extends MenuItem implements MenuContainer, javax.accessibility.Accessible
    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).

    Since:
    JDK1.0
    See Also:
    MenuItem, CheckboxMenuItem, Serialized Form
    • Constructors 
      Constructor and Description
      Ordinary member indicator Menu Reveal DetailHide Detail
      Constructs a new menu with an empty label.
      Ordinary member indicator Menu Reveal DetailHide Detail
      Constructs a new menu with the specified label.
      Ordinary member indicator Menu Reveal DetailHide Detail
      Constructs a new menu with the specified label, indicating whether the menu can be torn off.
    • Methods 
      Modifier and Type Method and Description
      Ordinary member indicator add Reveal DetailHide Detail
      Adds the specified menu item to this menu.
      Ordinary member indicator add Reveal DetailHide Detail
      Adds an item with the specified label to this menu.
      Inherited member indicator addActionListener Reveal DetailHide Detail
      Adds the specified action listener to receive action events from this menu item.
      Overridden member indicator addNotify Reveal DetailHide Detail
      Creates the menu's peer.
      Ordinary member indicator addSeparator Reveal DetailHide Detail
      Adds a separator line, or a hypen, to the menu at the current position.
      Ordinary member indicator countItems Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by getItemCount().
      Inherited member indicator deleteShortcut Reveal DetailHide Detail
      Delete any MenuShortcut object associated with this menu item.
      Inherited member indicator disable Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      Inherited member indicator dispatchEvent Reveal DetailHide Detail
      Delivers an event to this component or one of its sub components.
      Inherited member indicator enable Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      Inherited member indicator enable Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      Overridden member indicator getAccessibleContext Reveal DetailHide Detail
      Gets the AccessibleContext associated with this Menu.
      Inherited member indicator getActionCommand Reveal DetailHide Detail
      Gets the command name of the action event that is fired by this menu item.
      Inherited member indicator getActionListeners Reveal DetailHide Detail
      Returns an array of all the action listeners registered on this menu item.
      Inherited member indicator getFont Reveal DetailHide Detail
      Gets the font used for this menu component.
      Ordinary member indicator getItem Reveal DetailHide Detail
      Gets the item located at the specified index of this menu.
      Ordinary member indicator getItemCount Reveal DetailHide Detail
      Get the number of items in this menu.
      Inherited member indicator getLabel Reveal DetailHide Detail
      Gets the label for this menu item.
      Inherited member indicator getListeners Reveal DetailHide Detail
      Returns an array of all the objects currently registered as FooListeners upon this MenuItem.
      Inherited member indicator getName Reveal DetailHide Detail
      Gets the name of the menu component.
      Inherited member indicator getParent Reveal DetailHide Detail
      Returns the parent container for this menu component.
      Inherited member indicator getPeer Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, programs should not directly manipulate peers.
      Inherited member indicator getShortcut Reveal DetailHide Detail
      Get the MenuShortcut object associated with this menu item,
      Ordinary member indicator insert Reveal DetailHide Detail
      Inserts a menu item into this menu at the specified position.
      Ordinary member indicator insert Reveal DetailHide Detail
      Inserts a menu item with the specified label into this menu at the specified position.
      Ordinary member indicator insertSeparator Reveal DetailHide Detail
      Inserts a separator at the specified position.
      Inherited member indicator isEnabled Reveal DetailHide Detail
      Checks whether this menu item is enabled.
      Ordinary member indicator isTearOff Reveal DetailHide Detail
      Indicates whether this menu is a tear-off menu.
      Overridden member indicator paramString Reveal DetailHide Detail
      Returns a string representing the state of this Menu.
      Inherited member indicator postEvent Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by dispatchEvent.
      Ordinary member indicator remove Reveal DetailHide Detail
      Removes the menu item at the specified index from this menu.
      Ordinary member indicator remove Reveal DetailHide Detail
      Removes the specified menu item from this menu.
      Inherited member indicator removeActionListener Reveal DetailHide Detail
      Removes the specified action listener so it no longer receives action events from this menu item.
      Ordinary member indicator removeAll Reveal DetailHide Detail
      Removes all items from this menu.
      Overridden member indicator removeNotify Reveal DetailHide Detail
      Removes the menu's peer.
      Inherited member indicator setActionCommand Reveal DetailHide Detail
      Sets the command name of the action event that is fired by this menu item.
      Inherited member indicator setEnabled Reveal DetailHide Detail
      Sets whether or not this menu item can be chosen.
      Inherited member indicator setFont Reveal DetailHide Detail
      Sets the font to be used for this menu component to the specified font.
      Inherited member indicator setLabel Reveal DetailHide Detail
      Sets the label for this menu item to the specified label.
      Inherited member indicator setName Reveal DetailHide Detail
      Sets the name of the component to the specified string.
      Inherited member indicator setShortcut Reveal DetailHide Detail
      Set the MenuShortcut object associated with this menu item.
      Inherited member indicator toString Reveal DetailHide Detail
      Returns a representation of this menu component as a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge