JMenu (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

[JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[add](../../javax/swing/JMenu.html#add-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)

Creates a new menu item attached to the specifiedAction object and appends it to the end of this menu.

[Component](../../java/awt/Component.html "class in java.awt")

[add](../../javax/swing/JMenu.html#add-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") c)

Appends a component to the end of this menu.

[Component](../../java/awt/Component.html "class in java.awt")

[add](../../javax/swing/JMenu.html#add-java.awt.Component-int-)([Component](../../java/awt/Component.html "class in java.awt") c, int index)

Adds the specified component to this container at the given position.

[JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[add](../../javax/swing/JMenu.html#add-javax.swing.JMenuItem-)([JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing") menuItem)

Appends a menu item to the end of this menu.

[JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[add](../../javax/swing/JMenu.html#add-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") s)

Creates a new menu item with the specified text and appends it to the end of this menu.

void

[addMenuListener](../../javax/swing/JMenu.html#addMenuListener-javax.swing.event.MenuListener-)([MenuListener](../../javax/swing/event/MenuListener.html "interface in javax.swing.event") l)

Adds a listener for menu events.

void

[addSeparator](../../javax/swing/JMenu.html#addSeparator--)()

Appends a new separator to the end of the menu.

void

[applyComponentOrientation](../../javax/swing/JMenu.html#applyComponentOrientation-java.awt.ComponentOrientation-)([ComponentOrientation](../../java/awt/ComponentOrientation.html "class in java.awt") o)

Sets the ComponentOrientation property of this menu and all components contained within it.

protected [PropertyChangeListener](../../java/beans/PropertyChangeListener.html "interface in java.beans")

[createActionChangeListener](../../javax/swing/JMenu.html#createActionChangeListener-javax.swing.JMenuItem-)([JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing") b)

Returns a properly configured PropertyChangeListener which updates the control as changes to the Action occur.

protected [JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[createActionComponent](../../javax/swing/JMenu.html#createActionComponent-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)

Factory method which creates the JMenuItem forActions added to the JMenu.

protected [JMenu.WinListener](../../javax/swing/JMenu.WinListener.html "class in javax.swing")

[createWinListener](../../javax/swing/JMenu.html#createWinListener-javax.swing.JPopupMenu-)([JPopupMenu](../../javax/swing/JPopupMenu.html "class in javax.swing") p)

Creates a window-closing listener for the popup.

void

[doClick](../../javax/swing/JMenu.html#doClick-int-)(int pressTime)

Programmatically performs a "click".

protected void

[fireMenuCanceled](../../javax/swing/JMenu.html#fireMenuCanceled--)()

Notifies all listeners that have registered interest for notification on this event type.

protected void

[fireMenuDeselected](../../javax/swing/JMenu.html#fireMenuDeselected--)()

Notifies all listeners that have registered interest for notification on this event type.

protected void

[fireMenuSelected](../../javax/swing/JMenu.html#fireMenuSelected--)()

Notifies all listeners that have registered interest for notification on this event type.

[AccessibleContext](../../javax/accessibility/AccessibleContext.html "class in javax.accessibility")

[getAccessibleContext](../../javax/swing/JMenu.html#getAccessibleContext--)()

Gets the AccessibleContext associated with this JMenu.

[Component](../../java/awt/Component.html "class in java.awt")

[getComponent](../../javax/swing/JMenu.html#getComponent--)()

Returns the java.awt.Component used to paint this MenuElement.

int

[getDelay](../../javax/swing/JMenu.html#getDelay--)()

Returns the suggested delay, in milliseconds, before submenus are popped up or down.

[JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[getItem](../../javax/swing/JMenu.html#getItem-int-)(int pos)

Returns the JMenuItem at the specified position.

int

[getItemCount](../../javax/swing/JMenu.html#getItemCount--)()

Returns the number of items on the menu, including separators.

[Component](../../java/awt/Component.html "class in java.awt")

[getMenuComponent](../../javax/swing/JMenu.html#getMenuComponent-int-)(int n)

Returns the component at position n.

int

[getMenuComponentCount](../../javax/swing/JMenu.html#getMenuComponentCount--)()

Returns the number of components on the menu.

[Component](../../java/awt/Component.html "class in java.awt")[]

[getMenuComponents](../../javax/swing/JMenu.html#getMenuComponents--)()

Returns an array of Components of the menu's subcomponents.

[MenuListener](../../javax/swing/event/MenuListener.html "interface in javax.swing.event")[]

[getMenuListeners](../../javax/swing/JMenu.html#getMenuListeners--)()

Returns an array of all the MenuListeners added to this JMenu with addMenuListener().

[JPopupMenu](../../javax/swing/JPopupMenu.html "class in javax.swing")

[getPopupMenu](../../javax/swing/JMenu.html#getPopupMenu--)()

Returns the popupmenu associated with this menu.

protected [Point](../../java/awt/Point.html "class in java.awt")

[getPopupMenuOrigin](../../javax/swing/JMenu.html#getPopupMenuOrigin--)()

Computes the origin for the JMenu's popup menu.

[MenuElement](../../javax/swing/MenuElement.html "interface in javax.swing")[]

[getSubElements](../../javax/swing/JMenu.html#getSubElements--)()

Returns an array of MenuElements containing the submenu for this menu component.

[String](../../java/lang/String.html "class in java.lang")

[getUIClassID](../../javax/swing/JMenu.html#getUIClassID--)()

Returns the name of the L&F class that renders this component.

[JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[insert](../../javax/swing/JMenu.html#insert-javax.swing.Action-int-)([Action](../../javax/swing/Action.html "interface in javax.swing") a, int pos)

Inserts a new menu item attached to the specified Action object at a given position.

[JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing")

[insert](../../javax/swing/JMenu.html#insert-javax.swing.JMenuItem-int-)([JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing") mi, int pos)

Inserts the specified JMenuitem at a given position.

void

[insert](../../javax/swing/JMenu.html#insert-java.lang.String-int-)([String](../../java/lang/String.html "class in java.lang") s, int pos)

Inserts a new menu item with the specified text at a given position.

void

[insertSeparator](../../javax/swing/JMenu.html#insertSeparator-int-)(int index)

Inserts a separator at the specified position.

boolean

[isMenuComponent](../../javax/swing/JMenu.html#isMenuComponent-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") c)

Returns true if the specified component exists in the submenu hierarchy.

boolean

[isPopupMenuVisible](../../javax/swing/JMenu.html#isPopupMenuVisible--)()

Returns true if the menu's popup window is visible.

boolean

[isSelected](../../javax/swing/JMenu.html#isSelected--)()

Returns true if the menu is currently selected (highlighted).

boolean

[isTearOff](../../javax/swing/JMenu.html#isTearOff--)()

Returns true if the menu can be torn off.

boolean

[isTopLevelMenu](../../javax/swing/JMenu.html#isTopLevelMenu--)()

Returns true if the menu is a 'top-level menu', that is, if it is the direct child of a menubar.

void

[menuSelectionChanged](../../javax/swing/JMenu.html#menuSelectionChanged-boolean-)(boolean isIncluded)

Messaged when the menubar selection changes to activate or deactivate this menu.

protected [String](../../java/lang/String.html "class in java.lang")

[paramString](../../javax/swing/JMenu.html#paramString--)()

Returns a string representation of this JMenu.

protected void

[processKeyEvent](../../javax/swing/JMenu.html#processKeyEvent-java.awt.event.KeyEvent-)([KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") evt)

Processes key stroke events such as mnemonics and accelerators.

void

[remove](../../javax/swing/JMenu.html#remove-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") c)

Removes the component c from this menu.

void

[remove](../../javax/swing/JMenu.html#remove-int-)(int pos)

Removes the menu item at the specified index from this menu.

void

[remove](../../javax/swing/JMenu.html#remove-javax.swing.JMenuItem-)([JMenuItem](../../javax/swing/JMenuItem.html "class in javax.swing") item)

Removes the specified menu item from this menu.

void

[removeAll](../../javax/swing/JMenu.html#removeAll--)()

Removes all menu items from this menu.

void

[removeMenuListener](../../javax/swing/JMenu.html#removeMenuListener-javax.swing.event.MenuListener-)([MenuListener](../../javax/swing/event/MenuListener.html "interface in javax.swing.event") l)

Removes a listener for menu events.

void

[setAccelerator](../../javax/swing/JMenu.html#setAccelerator-javax.swing.KeyStroke-)([KeyStroke](../../javax/swing/KeyStroke.html "class in javax.swing") keyStroke)

setAccelerator is not defined for JMenu.

void

[setComponentOrientation](../../javax/swing/JMenu.html#setComponentOrientation-java.awt.ComponentOrientation-)([ComponentOrientation](../../java/awt/ComponentOrientation.html "class in java.awt") o)

Sets the language-sensitive orientation that is to be used to order the elements or text within this component.

void

[setDelay](../../javax/swing/JMenu.html#setDelay-int-)(int d)

Sets the suggested delay before the menu's PopupMenu is popped up or down.

void

[setMenuLocation](../../javax/swing/JMenu.html#setMenuLocation-int-int-)(int x, int y)

Sets the location of the popup component.

void

[setModel](../../javax/swing/JMenu.html#setModel-javax.swing.ButtonModel-)([ButtonModel](../../javax/swing/ButtonModel.html "interface in javax.swing") newModel)

Sets the data model for the "menu button" -- the label that the user clicks to open or close the menu.

void

[setPopupMenuVisible](../../javax/swing/JMenu.html#setPopupMenuVisible-boolean-)(boolean b)

Sets the visibility of the menu's popup.

void

[setSelected](../../javax/swing/JMenu.html#setSelected-boolean-)(boolean b)

Sets the selection status of the menu.

void

[updateUI](../../javax/swing/JMenu.html#updateUI--)()

Resets the UI property with a value from the current look and feel.