Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
public class: JMenu [javadoc | source]
java.lang.Object
   java.awt.Component
      java.awt.Container
         javax.swing.JComponent
            javax.swing.AbstractButton
               javax.swing.JMenuItem
                  javax.swing.JMenu

All Implemented Interfaces:
    MenuElement, Accessible, SwingConstants, ItemSelectable, HasGetTransferHandler, Serializable, MenuContainer, ImageObserver

Direct Known Subclasses:
    ParentMenu

An implementation of a menu -- a popup window containing JMenuItems that is displayed when the user selects an item on the JMenuBar. In addition to JMenuItems, a JMenu can also contain JSeparators.

In essence, a menu is a button with an associated JPopupMenu. When the "button" is pressed, the JPopupMenu appears. If the "button" is on the JMenuBar, the menu is a top-level window. If the "button" is another menu item, then the JPopupMenu is "pull-right" menu.

Menus can be configured, and to some degree controlled, by Actions. Using an Action with a menu has many benefits beyond directly configuring a menu. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For information and examples of using menus see How to Use Menus, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .

Nested Class Summary:
class  JMenu.MenuChangeListener   
protected class  JMenu.WinListener  A listener class that watches for a popup window closing. When the popup is closing, the listener deselects the menu.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

protected class  JMenu.AccessibleJMenu  This class implements accessibility support for the JMenu class. It provides an implementation of the Java Accessibility API appropriate to menu user-interface elements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

Field Summary
protected  WinListener popupListener    The window-closing listener for the popup. 
Fields inherited from javax.swing.AbstractButton:
MODEL_CHANGED_PROPERTY,  TEXT_CHANGED_PROPERTY,  MNEMONIC_CHANGED_PROPERTY,  MARGIN_CHANGED_PROPERTY,  VERTICAL_ALIGNMENT_CHANGED_PROPERTY,  HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY,  VERTICAL_TEXT_POSITION_CHANGED_PROPERTY,  HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY,  BORDER_PAINTED_CHANGED_PROPERTY,  FOCUS_PAINTED_CHANGED_PROPERTY,  ROLLOVER_ENABLED_CHANGED_PROPERTY,  CONTENT_AREA_FILLED_CHANGED_PROPERTY,  ICON_CHANGED_PROPERTY,  PRESSED_ICON_CHANGED_PROPERTY,  SELECTED_ICON_CHANGED_PROPERTY,  ROLLOVER_ICON_CHANGED_PROPERTY,  ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY,  DISABLED_ICON_CHANGED_PROPERTY,  DISABLED_SELECTED_ICON_CHANGED_PROPERTY,  model,  defaultCapable,  changeListener,  actionListener,  itemListener,  changeEvent
Fields inherited from javax.swing.JComponent:
DEBUG_GRAPHICS_LOADED,  ui,  listenerList,  paintingChild,  WHEN_FOCUSED,  WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,  WHEN_IN_FOCUSED_WINDOW,  UNDEFINED_CONDITION,  TOOL_TIP_TEXT_KEY,  focusController,  accessibleContext
Fields inherited from java.awt.Container:
layoutMgr,  containerListener,  listeningChildren,  listeningBoundsChildren,  descendantsCount,  preserveBackgroundColor,  INCLUDE_SELF,  SEARCH_HEAVYWEIGHTS,  modalComp,  modalAppContext
Fields inherited from java.awt.Component:
peer,  parent,  appContext,  x,  y,  width,  height,  foreground,  background,  font,  peerFont,  cursor,  locale,  bufferStrategy,  ignoreRepaint,  visible,  enabled,  dropTarget,  popups,  focusTraversalKeys,  LOCK,  minSize,  minSizeSet,  prefSize,  prefSizeSet,  maxSize,  maxSizeSet,  componentOrientation,  newEventsOnly,  componentListener,  focusListener,  hierarchyListener,  hierarchyBoundsListener,  keyListener,  mouseListener,  mouseMotionListener,  mouseWheelListener,  inputMethodListener,  windowClosingException,  actionListenerK,  adjustmentListenerK,  componentListenerK,  containerListenerK,  focusListenerK,  itemListenerK,  keyListenerK,  mouseListenerK,  mouseMotionListenerK,  mouseWheelListenerK,  textListenerK,  ownedWindowK,  windowListenerK,  inputMethodListenerK,  hierarchyListenerK,  hierarchyBoundsListenerK,  windowStateListenerK,  windowFocusListenerK,  eventMask,  isInc,  incRate,  TOP_ALIGNMENT,  CENTER_ALIGNMENT,  BOTTOM_ALIGNMENT,  LEFT_ALIGNMENT,  RIGHT_ALIGNMENT,  isPacked,  backgroundEraseDisabled,  eventCache,  accessibleContext
Constructor:
 public JMenu() 
 public JMenu(String s) 
    Constructs a new JMenu with the supplied string as its text.
    Parameters:
    s - the text for the menu label
 public JMenu(Action a) 
    Constructs a menu whose properties are taken from the Action supplied.
    Parameters:
    a - an Action
    since: 1.3 -
 public JMenu(String s,
    boolean b) 
    Constructs a new JMenu with the supplied string as its text and specified as a tear-off menu or not.
    Parameters:
    s - the text for the menu label
    b - can the menu be torn off (not yet implemented)
Method from javax.swing.JMenu Summary:
add,   add,   add,   add,   add,   addMenuListener,   addSeparator,   applyComponentOrientation,   configureAcceleratorFromAction,   createActionChangeListener,   createActionComponent,   createWinListener,   doClick,   fireMenuCanceled,   fireMenuDeselected,   fireMenuSelected,   getAccessibleContext,   getComponent,   getDelay,   getItem,   getItemCount,   getMenuComponent,   getMenuComponentCount,   getMenuComponents,   getMenuListeners,   getPopupMenu,   getPopupMenuOrigin,   getSubElements,   getUIClassID,   initFocusability,   insert,   insert,   insert,   insertSeparator,   isMenuComponent,   isPopupMenuVisible,   isSelected,   isTearOff,   isTopLevelMenu,   menuSelectionChanged,   paramString,   processKeyEvent,   remove,   remove,   remove,   removeAll,   removeMenuListener,   setAccelerator,   setComponentOrientation,   setDelay,   setMenuLocation,   setModel,   setPopupMenuVisible,   setSelected,   updateUI
Methods from javax.swing.JMenuItem:
actionPropertyChanged,   addMenuDragMouseListener,   addMenuKeyListener,   alwaysOnTop,   configureAcceleratorFromAction,   configurePropertiesFromAction,   fireMenuDragMouseDragged,   fireMenuDragMouseEntered,   fireMenuDragMouseExited,   fireMenuDragMouseReleased,   fireMenuKeyPressed,   fireMenuKeyReleased,   fireMenuKeyTyped,   getAccelerator,   getAccessibleContext,   getComponent,   getMenuDragMouseListeners,   getMenuKeyListeners,   getSubElements,   getUIClassID,   init,   initFocusability,   isArmed,   largeIconChanged,   menuSelectionChanged,   paramString,   processKeyEvent,   processMenuDragMouseEvent,   processMenuKeyEvent,   processMouseEvent,   removeMenuDragMouseListener,   removeMenuKeyListener,   setAccelerator,   setArmed,   setEnabled,   setIconFromAction,   setModel,   setUI,   smallIconChanged,   updateUI
Methods from javax.swing.AbstractButton:
actionPropertyChanged,   addActionListener,   addChangeListener,   addImpl,   addItemListener,   checkHorizontalKey,   checkVerticalKey,   clientPropertyChanged,   configurePropertiesFromAction,   createActionListener,   createActionPropertyChangeListener,   createActionPropertyChangeListener0,   createChangeListener,   createItemListener,   doClick,   doClick,   fireActionPerformed,   fireItemStateChanged,   fireStateChanged,   getAction,   getActionCommand,   getActionListeners,   getChangeListeners,   getDisabledIcon,   getDisabledSelectedIcon,   getDisplayedMnemonicIndex,   getHideActionText,   getHorizontalAlignment,   getHorizontalTextPosition,   getIcon,   getIconTextGap,   getItemListeners,   getLabel,   getMargin,   getMnemonic,   getModel,   getMultiClickThreshhold,   getPressedIcon,   getRolloverIcon,   getRolloverSelectedIcon,   getSelectedIcon,   getSelectedObjects,   getText,   getUI,   getVerticalAlignment,   getVerticalTextPosition,   imageUpdate,   init,   isBorderPainted,   isContentAreaFilled,   isFocusPainted,   isRolloverEnabled,   isSelected,   largeIconChanged,   paintBorder,   paramString,   removeActionListener,   removeChangeListener,   removeItemListener,   removeNotify,   setAction,   setActionCommand,   setBorderPainted,   setContentAreaFilled,   setDisabledIcon,   setDisabledSelectedIcon,   setDisplayedMnemonicIndex,   setEnabled,   setFocusPainted,   setHideActionText,   setHorizontalAlignment,   setHorizontalTextPosition,   setIcon,   setIconFromAction,   setIconTextGap,   setLabel,   setLayout,   setMargin,   setMnemonic,   setMnemonic,   setModel,   setMultiClickThreshhold,   setPressedIcon,   setRolloverEnabled,   setRolloverIcon,   setRolloverSelectedIcon,   setSelected,   setSelectedIcon,   setText,   setUI,   setUIProperty,   setVerticalAlignment,   setVerticalTextPosition,   shouldUpdateSelectedStateFromAction,   smallIconChanged,   updateUI
Methods from javax.swing.JComponent:
_paintImmediately,   addAncestorListener,   addNotify,   addVetoableChangeListener,   alwaysOnTop,   checkIfChildObscuredBySibling,   clientPropertyChanged,   compWriteObjectNotify,   componentInputMapChanged,   computeVisibleRect,   computeVisibleRect,   contains,   createToolTip,   disable,   dndDone,   dropLocationForPoint,   enable,   firePropertyChange,   firePropertyChange,   firePropertyChange,   fireVetoableChange,   getAccessibleContext,   getActionForKeyStroke,   getActionMap,   getActionMap,   getAlignmentX,   getAlignmentY,   getAncestorListeners,   getAutoscrolls,   getBaseline,   getBaselineResizeBehavior,   getBorder,   getBounds,   getClientProperty,   getComponentGraphics,   getComponentPopupMenu,   getConditionForKeyStroke,   getCreatedDoubleBuffer,   getDebugGraphicsOptions,   getDefaultLocale,   getFontMetrics,   getGraphics,   getGraphicsInvoked,   getHeight,   getInheritsPopupMenu,   getInputMap,   getInputMap,   getInputMap,   getInputVerifier,   getInsets,   getInsets,   getListeners,   getLocation,   getManagingFocusBackwardTraversalKeys,   getManagingFocusForwardTraversalKeys,   getMaximumSize,   getMinimumSize,   getNextFocusableComponent,   getPopupLocation,   getPreferredSize,   getRegisteredKeyStrokes,   getRootPane,   getSize,   getToolTipLocation,   getToolTipText,   getToolTipText,   getTopLevelAncestor,   getTransferHandler,   getUIClassID,   getVerifyInputWhenFocusTarget,   getVetoableChangeListeners,   getVisibleRect,   getWidth,   getWriteObjCounter,   getX,   getY,   grabFocus,   isDoubleBuffered,   isLightweightComponent,   isManagingFocus,   isOpaque,   isOptimizedDrawingEnabled,   isPainting,   isPaintingForPrint,   isPaintingOrigin,   isPaintingTile,   isRequestFocusEnabled,   isValidateRoot,   paint,   paintBorder,   paintChildren,   paintComponent,   paintForceDoubleBuffered,   paintImmediately,   paintImmediately,   paintToOffscreen,   paramString,   print,   printAll,   printBorder,   printChildren,   printComponent,   processComponentKeyEvent,   processKeyBinding,   processKeyBindings,   processKeyBindingsForAllComponents,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   putClientProperty,   rectangleIsObscured,   registerKeyboardAction,   registerKeyboardAction,   removeAncestorListener,   removeNotify,   removeVetoableChangeListener,   repaint,   repaint,   requestDefaultFocus,   requestFocus,   requestFocus,   requestFocusInWindow,   requestFocusInWindow,   resetKeyboardActions,   reshape,   revalidate,   safelyGetGraphics,   safelyGetGraphics,   scrollRectToVisible,   setActionMap,   setAlignmentX,   setAlignmentY,   setAutoscrolls,   setBackground,   setBorder,   setComponentPopupMenu,   setCreatedDoubleBuffer,   setDebugGraphicsOptions,   setDefaultLocale,   setDoubleBuffered,   setDropLocation,   setEnabled,   setFocusTraversalKeys,   setFont,   setForeground,   setInheritsPopupMenu,   setInputMap,   setInputVerifier,   setMaximumSize,   setMinimumSize,   setNextFocusableComponent,   setOpaque,   setPaintingChild,   setPreferredSize,   setRequestFocusEnabled,   setToolTipText,   setTransferHandler,   setUI,   setUIProperty,   setVerifyInputWhenFocusTarget,   setVisible,   setWriteObjCounter,   shouldDebugGraphics,   superProcessMouseMotionEvent,   unregisterKeyboardAction,   update,   updateUI
Methods from java.awt.Container:
add,   add,   add,   add,   add,   addContainerListener,   addImpl,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustDecendantsOnParent,   adjustDescendants,   adjustListeningChildren,   applyComponentOrientation,   areFocusTraversalKeysSet,   canContainFocusOwner,   checkGD,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   containsFocus,   countComponents,   countHierarchyMembers,   createChildHierarchyEvents,   createHierarchyEvents,   decreaseComponentCount,   deliverEvent,   dispatchEventImpl,   dispatchEventToSelf,   doLayout,   eventEnabled,   findComponentAt,   findComponentAt,   findComponentAt,   findComponentAtImpl,   getAccessibleAt,   getAccessibleChild,   getAccessibleChildrenCount,   getAlignmentX,   getAlignmentY,   getComponent,   getComponentAt,   getComponentAt,   getComponentCount,   getComponentZOrder,   getComponents,   getComponentsSync,   getComponents_NoClientCode,   getContainerListeners,   getDropTargetEventTarget,   getFocusTraversalKeys,   getFocusTraversalPolicy,   getHeavyweightContainer,   getInsets,   getLayout,   getListeners,   getMaximumSize,   getMinimumSize,   getMouseEventTarget,   getMousePosition,   getOpaqueShape,   getPreferredSize,   getTraversalRoot,   hasHeavyweightDescendants,   hasLightweightDescendants,   increaseComponentCount,   initializeFocusTraversalKeys,   insets,   invalidate,   invalidateParent,   invalidateTree,   isAncestorOf,   isFocusCycleRoot,   isFocusCycleRoot,   isFocusTraversalPolicyProvider,   isFocusTraversalPolicySet,   isRecursivelyVisibleUpToHeavyweightContainer,   isSameOrAncestorOf,   isValidateRoot,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   locate,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   numListening,   paint,   paintComponents,   paintHeavyweightComponents,   paramString,   postProcessKeyEvent,   postsOldMouseEvents,   preProcessKeyEvent,   preferredSize,   print,   printComponents,   printHeavyweightComponents,   processContainerEvent,   processEvent,   proxyEnableEvents,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   remove,   remove,   removeAll,   removeContainerListener,   removeNotify,   setComponentZOrder,   setFocusCycleRoot,   setFocusTraversalKeys,   setFocusTraversalPolicy,   setFocusTraversalPolicyProvider,   setFont,   setLayout,   transferFocusDownCycle,   update,   updateGraphicsData,   validate,   validateTree,   validateUnconditionally
Methods from java.awt.Component:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustListeningChildrenOnParent,   applyComponentOrientation,   applyCompoundShape,   applyCurrentShape,   areBoundsValid,   areFocusTraversalKeysSet,   areInputMethodsEnabled,   autoProcessMouseWheel,   bounds,   canBeFocusOwner,   canBeFocusOwnerRecursively,   checkGD,   checkImage,   checkImage,   checkTreeLock,   checkWindowClosingException,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   coalesceEvents,   constructComponentName,   contains,   contains,   containsFocus,   countHierarchyMembers,   createBufferStrategy,   createBufferStrategy,   createHierarchyEvents,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   disableEvents,   dispatchEvent,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   doLayout,   enable,   enable,   enableEvents,   enableInputMethods,   eventEnabled,   eventTypeEnabled,   findUnderMouseInWindow,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   getAccessControlContext,   getAccessibleContext,   getAccessibleIndexInParent,   getAccessibleStateSet,   getAlignmentX,   getAlignmentY,   getBackBuffer,   getBackground,   getBaseline,   getBaselineResizeBehavior,   getBounds,   getBounds,   getBoundsOp,   getBufferStrategy,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getContainer,   getContainingWindow,   getCursor,   getCursor_NoClientCode,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFocusTraversalKeys_NoIDCheck,   getFont,   getFontMetrics,   getFont_NoClientCode,   getForeground,   getGraphics,   getGraphicsConfiguration,   getGraphicsConfiguration_NoClientCode,   getGraphics_NoClientCode,   getHWPeerAboveMe,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getLocationOnScreen_NoTreeLock,   getLocationOnWindow,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMousePosition,   getMouseWheelListeners,   getName,   getNativeContainer,   getNextFocusCandidate,   getNormalShape,   getObjectLock,   getOpaqueShape,   getParent,   getParent_NoClientCode,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSiblingIndexAbove,   getSiblingIndexBelow,   getSize,   getSize,   getToolkit,   getToolkitImpl,   getTraversalRoot,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   initializeFocusTraversalKeys,   inside,   invalidate,   invalidateIfValid,   invalidateParent,   isAutoFocusTransferOnDisposal,   isBackgroundSet,   isCoalescingEnabled,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isEnabledImpl,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusTraversableOverridden,   isFocusable,   isFontSet,   isForegroundSet,   isInstanceOf,   isLightweight,   isMaximumSizeSet,   isMinimumSizeSet,   isMixingNeeded,   isNonOpaqueForMixing,   isOpaque,   isPreferredSizeSet,   isRecursivelyVisible,   isSameOrAncestorOf,   isShowing,   isValid,   isVisible,   isVisible_NoClientCode,   keyDown,   keyUp,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   numListening,   paint,   paintAll,   paintHeavyweightComponents,   paramString,   pointRelativeToComponent,   postEvent,   postsOldMouseEvents,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   printHeavyweightComponents,   processComponentEvent,   processEvent,   processFocusEvent,   processHierarchyBoundsEvent,   processHierarchyEvent,   processInputMethodEvent,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   processMouseWheelEvent,   relocateComponent,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocus,   requestFocus,   requestFocus,   requestFocusHelper,   requestFocusHelper,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   reshape,   resize,   resize,   revalidate,   setAutoFocusTransferOnDisposal,   setBackground,   setBounds,   setBounds,   setBoundsOp,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusTraversalKeys_NoIDCheck,   setFocusable,   setFont,   setForeground,   setGraphicsConfiguration,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setMaximumSize,   setMinimumSize,   setName,   setPreferredSize,   setRequestFocusController,   setSize,   setSize,   setVisible,   show,   show,   size,   subtractAndApplyShape,   subtractAndApplyShapeBelowMe,   toString,   transferFocus,   transferFocus,   transferFocusBackward,   transferFocusBackward,   transferFocusUpCycle,   update,   updateCursorImmediately,   updateGraphicsData,   updateZOrder,   validate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.JMenu Detail:
 public JMenuItem add(JMenuItem menuItem) 
    Appends a menu item to the end of this menu. Returns the menu item added.
 public Component add(Component c) 
    Appends a component to the end of this menu. Returns the component added.
 public JMenuItem add(String s) 
    Creates a new menu item with the specified text and appends it to the end of this menu.
 public JMenuItem add(Action a) 
    Creates a new menu item attached to the specified Action object and appends it to the end of this menu.
 public Component add(Component c,
    int index) 
    Adds the specified component to this container at the given position. If index equals -1, the component will be appended to the end.
 public  void addMenuListener(MenuListener l) 
    Adds a listener for menu events.
 public  void addSeparator() 
    Appends a new separator to the end of the menu.
 public  void applyComponentOrientation(ComponentOrientation o) 
    Sets the ComponentOrientation property of this menu and all components contained within it. This includes all components returned by getMenuComponents .
  void configureAcceleratorFromAction(Action a) 
 protected PropertyChangeListener createActionChangeListener(JMenuItem b) 
    Returns a properly configured PropertyChangeListener which updates the control as changes to the Action occur.
 protected JMenuItem createActionComponent(Action a) 
    Factory method which creates the JMenuItem for Actions added to the JMenu.
 protected WinListener createWinListener(JPopupMenu p) 
    Creates a window-closing listener for the popup.
 public  void doClick(int pressTime) 
    Programmatically performs a "click". This overrides the method AbstractButton.doClick in order to make the menu pop up.
 protected  void fireMenuCanceled() 
    Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.
 protected  void fireMenuDeselected() 
    Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.
 protected  void fireMenuSelected() 
    Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.
 public AccessibleContext getAccessibleContext() 
    Gets the AccessibleContext associated with this JMenu. For JMenus, the AccessibleContext takes the form of an AccessibleJMenu. A new AccessibleJMenu instance is created if necessary.
 public Component getComponent() 
    Returns the java.awt.Component used to paint this MenuElement. The returned component is used to convert events and detect if an event is inside a menu component.
 public int getDelay() 
    Returns the suggested delay, in milliseconds, before submenus are popped up or down. Each look and feel (L&F) may determine its own policy for observing the delay property. In most cases, the delay is not observed for top level menus or while dragging. The default for delay is 0. This method is a property of the look and feel code and is used to manage the idiosyncracies of the various UI implementations.
 public JMenuItem getItem(int pos) 
    Returns the JMenuItem at the specified position. If the component at pos is not a menu item, null is returned. This method is included for AWT compatibility.
 public int getItemCount() 
    Returns the number of items on the menu, including separators. This method is included for AWT compatibility.
 public Component getMenuComponent(int n) 
    Returns the component at position n.
 public int getMenuComponentCount() 
    Returns the number of components on the menu.
 public Component[] getMenuComponents() 
    Returns an array of Components of the menu's subcomponents. Note that this returns all Components in the popup menu, including separators.
 public MenuListener[] getMenuListeners() 
    Returns an array of all the MenuListeners added to this JMenu with addMenuListener().
 public JPopupMenu getPopupMenu() 
    Returns the popupmenu associated with this menu. If there is no popupmenu, it will create one.
 protected Point getPopupMenuOrigin() 
    Computes the origin for the JMenu's popup menu. This method uses Look and Feel properties named Menu.menuPopupOffsetX, Menu.menuPopupOffsetY, Menu.submenuPopupOffsetX, and Menu.submenuPopupOffsetY to adjust the exact location of popup.
 public MenuElement[] getSubElements() 
    Returns an array of MenuElements containing the submenu for this menu component. If popup menu is null returns an empty array. This method is required to conform to the MenuElement interface. Note that since JSeparators do not conform to the MenuElement interface, this array will only contain JMenuItems.
 public String getUIClassID() 
    Returns the name of the L&F class that renders this component.
  void initFocusability() 
    Overriden to do nothing. We want JMenu to be focusable, but JMenuItem doesn't want to be, thus we override this do nothing. We don't invoke setFocusable(true) after super's constructor has completed as this has the side effect that JMenu will be considered traversable via the keyboard, which we don't want. Making a Component traversable by the keyboard after invoking setFocusable(true) is OK, as setFocusable is new API and is speced as such, but internally we don't want to use it like this else we change the keyboard traversability.
 public  void insert(String s,
    int pos) 
    Inserts a new menu item with the specified text at a given position.
 public JMenuItem insert(JMenuItem mi,
    int pos) 
    Inserts the specified JMenuitem at a given position.
 public JMenuItem insert(Action a,
    int pos) 
    Inserts a new menu item attached to the specified Action object at a given position.
 public  void insertSeparator(int index) 
    Inserts a separator at the specified position.
 public boolean isMenuComponent(Component c) 
    Returns true if the specified component exists in the submenu hierarchy.
 public boolean isPopupMenuVisible() 
    Returns true if the menu's popup window is visible.
 public boolean isSelected() 
    Returns true if the menu is currently selected (highlighted).
 public boolean isTearOff() 
    Returns true if the menu can be torn off. This method is not yet implemented.
 public boolean isTopLevelMenu() 
    Returns true if the menu is a 'top-level menu', that is, if it is the direct child of a menubar.
 public  void menuSelectionChanged(boolean isIncluded) 
    Messaged when the menubar selection changes to activate or deactivate this menu. Overrides JMenuItem.menuSelectionChanged.
 protected String paramString() 
    Returns a string representation of this JMenu. 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.
 protected  void processKeyEvent(KeyEvent evt) 
    Processes key stroke events such as mnemonics and accelerators.
 public  void remove(JMenuItem item) 
    Removes the specified menu item from this menu. If there is no popup menu, this method will have no effect.
 public  void remove(int pos) 
    Removes the menu item at the specified index from this menu.
 public  void remove(Component c) 
    Removes the component c from this menu.
 public  void removeAll() 
    Removes all menu items from this menu.
 public  void removeMenuListener(MenuListener l) 
    Removes a listener for menu events.
 public  void setAccelerator(KeyStroke keyStroke) 
    setAccelerator is not defined for JMenu. Use setMnemonic instead.
 public  void setComponentOrientation(ComponentOrientation o) 
 public  void setDelay(int d) 
    Sets the suggested delay before the menu's PopupMenu is popped up or down. Each look and feel (L&F) may determine it's own policy for observing the delay property. In most cases, the delay is not observed for top level menus or while dragging. This method is a property of the look and feel code and is used to manage the idiosyncracies of the various UI implementations.
 public  void setMenuLocation(int x,
    int y) 
    Sets the location of the popup component.
 public  void setModel(ButtonModel newModel) 
    Sets the data model for the "menu button" -- the label that the user clicks to open or close the menu.
 public  void setPopupMenuVisible(boolean b) 
    Sets the visibility of the menu's popup. If the menu is not enabled, this method will have no effect.
 public  void setSelected(boolean b) 
    Sets the selection status of the menu.
 public  void updateUI() 
    Resets the UI property with a value from the current look and feel.