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

Modifier and Type

Method

Description

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

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

Appends a new menu item to the end of the menu which dispatches the specified Action object.

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

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

Appends the specified menu item to the end of this menu.

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

[add](../../javax/swing/JPopupMenu.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

[addMenuKeyListener](../../javax/swing/JPopupMenu.html#addMenuKeyListener-javax.swing.event.MenuKeyListener-)([MenuKeyListener](../../javax/swing/event/MenuKeyListener.html "interface in javax.swing.event") l)

Adds a MenuKeyListener to the popup menu.

void

[addPopupMenuListener](../../javax/swing/JPopupMenu.html#addPopupMenuListener-javax.swing.event.PopupMenuListener-)([PopupMenuListener](../../javax/swing/event/PopupMenuListener.html "interface in javax.swing.event") l)

Adds a PopupMenu listener.

void

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

Appends a new separator at the end of the menu.

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

[createActionChangeListener](../../javax/swing/JPopupMenu.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/JPopupMenu.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 JPopupMenu.

protected void

[firePopupMenuCanceled](../../javax/swing/JPopupMenu.html#firePopupMenuCanceled--)()

Notifies PopupMenuListeners that this popup menu is cancelled.

protected void

[firePopupMenuWillBecomeInvisible](../../javax/swing/JPopupMenu.html#firePopupMenuWillBecomeInvisible--)()

Notifies PopupMenuListeners that this popup menu will become invisible.

protected void

[firePopupMenuWillBecomeVisible](../../javax/swing/JPopupMenu.html#firePopupMenuWillBecomeVisible--)()

Notifies PopupMenuListeners that this popup menu will become visible.

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

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

Gets the AccessibleContext associated with this JPopupMenu.

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

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

Returns this JPopupMenu component.

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

[getComponentAtIndex](../../javax/swing/JPopupMenu.html#getComponentAtIndex-int-)(int i)

int

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

Returns the index of the specified component.

static boolean

[getDefaultLightWeightPopupEnabled](../../javax/swing/JPopupMenu.html#getDefaultLightWeightPopupEnabled--)()

Gets the defaultLightWeightPopupEnabled property, which by default is true.

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

[getInvoker](../../javax/swing/JPopupMenu.html#getInvoker--)()

Returns the component which is the 'invoker' of this popup menu.

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

[getLabel](../../javax/swing/JPopupMenu.html#getLabel--)()

Returns the popup menu's label

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

[getMargin](../../javax/swing/JPopupMenu.html#getMargin--)()

Returns the margin, in pixels, between the popup menu's border and its containers.

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

[getMenuKeyListeners](../../javax/swing/JPopupMenu.html#getMenuKeyListeners--)()

Returns an array of all the MenuKeyListeners added to this JPopupMenu with addMenuKeyListener().

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

[getPopupMenuListeners](../../javax/swing/JPopupMenu.html#getPopupMenuListeners--)()

Returns an array of all the PopupMenuListeners added to this JMenuItem with addPopupMenuListener().

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

[getSelectionModel](../../javax/swing/JPopupMenu.html#getSelectionModel--)()

Returns the model object that handles single selections.

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

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

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

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

[getUI](../../javax/swing/JPopupMenu.html#getUI--)()

Returns the look and feel (L&F) object that renders this component.

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

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

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

void

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

Inserts a menu item for the specified Action object at a given position.

void

[insert](../../javax/swing/JPopupMenu.html#insert-java.awt.Component-int-)([Component](../../java/awt/Component.html "class in java.awt") component, int index)

Inserts the specified component into the menu at a given position.

boolean

[isBorderPainted](../../javax/swing/JPopupMenu.html#isBorderPainted--)()

Checks whether the border should be painted.

boolean

[isLightWeightPopupEnabled](../../javax/swing/JPopupMenu.html#isLightWeightPopupEnabled--)()

Gets the lightWeightPopupEnabled property.

boolean

[isPopupTrigger](../../javax/swing/JPopupMenu.html#isPopupTrigger-java.awt.event.MouseEvent-)([MouseEvent](../../java/awt/event/MouseEvent.html "class in java.awt.event") e)

Returns true if the MouseEvent is considered a popup trigger by the JPopupMenu's currently installed UI.

boolean

[isVisible](../../javax/swing/JPopupMenu.html#isVisible--)()

Returns true if the popup menu is visible (currently being displayed).

void

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

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

void

[pack](../../javax/swing/JPopupMenu.html#pack--)()

Lays out the container so that it uses the minimum space needed to display its contents.

protected void

[paintBorder](../../javax/swing/JPopupMenu.html#paintBorder-java.awt.Graphics-)([Graphics](../../java/awt/Graphics.html "class in java.awt") g)

Paints the popup menu's border if the borderPainted property is true.

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

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

Returns a string representation of this JPopupMenu.

protected void

[processFocusEvent](../../javax/swing/JPopupMenu.html#processFocusEvent-java.awt.event.FocusEvent-)([FocusEvent](../../java/awt/event/FocusEvent.html "class in java.awt.event") evt)

Processes focus events occurring on this component by dispatching them to any registeredFocusListener objects.

protected void

[processKeyEvent](../../javax/swing/JPopupMenu.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

[processKeyEvent](../../javax/swing/JPopupMenu.html#processKeyEvent-java.awt.event.KeyEvent-javax.swing.MenuElement:A-javax.swing.MenuSelectionManager-)([KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") e,[MenuElement](../../javax/swing/MenuElement.html "interface in javax.swing")[] path,[MenuSelectionManager](../../javax/swing/MenuSelectionManager.html "class in javax.swing") manager)

Processes a key event forwarded from theMenuSelectionManager and changes the menu selection, if necessary, by using MenuSelectionManager's API.

void

[processMouseEvent](../../javax/swing/JPopupMenu.html#processMouseEvent-java.awt.event.MouseEvent-javax.swing.MenuElement:A-javax.swing.MenuSelectionManager-)([MouseEvent](../../java/awt/event/MouseEvent.html "class in java.awt.event") event,[MenuElement](../../javax/swing/MenuElement.html "interface in javax.swing")[] path,[MenuSelectionManager](../../javax/swing/MenuSelectionManager.html "class in javax.swing") manager)

This method is required to conform to theMenuElement interface, but it not implemented.

void

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

Removes the component at the specified index from this popup menu.

void

[removeMenuKeyListener](../../javax/swing/JPopupMenu.html#removeMenuKeyListener-javax.swing.event.MenuKeyListener-)([MenuKeyListener](../../javax/swing/event/MenuKeyListener.html "interface in javax.swing.event") l)

Removes a MenuKeyListener from the popup menu.

void

[removePopupMenuListener](../../javax/swing/JPopupMenu.html#removePopupMenuListener-javax.swing.event.PopupMenuListener-)([PopupMenuListener](../../javax/swing/event/PopupMenuListener.html "interface in javax.swing.event") l)

Removes a PopupMenu listener.

void

[setBorderPainted](../../javax/swing/JPopupMenu.html#setBorderPainted-boolean-)(boolean b)

Sets whether the border should be painted.

static void

[setDefaultLightWeightPopupEnabled](../../javax/swing/JPopupMenu.html#setDefaultLightWeightPopupEnabled-boolean-)(boolean aFlag)

Sets the default value of the lightWeightPopupEnabled property.

void

[setInvoker](../../javax/swing/JPopupMenu.html#setInvoker-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") invoker)

Sets the invoker of this popup menu -- the component in which the popup menu menu is to be displayed.

void

[setLabel](../../javax/swing/JPopupMenu.html#setLabel-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") label)

Sets the popup menu's label.

void

[setLightWeightPopupEnabled](../../javax/swing/JPopupMenu.html#setLightWeightPopupEnabled-boolean-)(boolean aFlag)

Sets the value of the lightWeightPopupEnabled property, which by default is true.

void

[setLocation](../../javax/swing/JPopupMenu.html#setLocation-int-int-)(int x, int y)

Sets the location of the upper left corner of the popup menu using x, y coordinates.

void

[setPopupSize](../../javax/swing/JPopupMenu.html#setPopupSize-java.awt.Dimension-)([Dimension](../../java/awt/Dimension.html "class in java.awt") d)

Sets the size of the Popup window using a Dimension object.

void

[setPopupSize](../../javax/swing/JPopupMenu.html#setPopupSize-int-int-)(int width, int height)

Sets the size of the Popup window to the specified width and height.

void

[setSelected](../../javax/swing/JPopupMenu.html#setSelected-java.awt.Component-)([Component](../../java/awt/Component.html "class in java.awt") sel)

Sets the currently selected component, This will result in a change to the selection model.

void

[setSelectionModel](../../javax/swing/JPopupMenu.html#setSelectionModel-javax.swing.SingleSelectionModel-)([SingleSelectionModel](../../javax/swing/SingleSelectionModel.html "interface in javax.swing") model)

Sets the model object to handle single selections.

void

[setUI](../../javax/swing/JPopupMenu.html#setUI-javax.swing.plaf.PopupMenuUI-)([PopupMenuUI](../../javax/swing/plaf/PopupMenuUI.html "class in javax.swing.plaf") ui)

Sets the L&F object that renders this component.

void

[setVisible](../../javax/swing/JPopupMenu.html#setVisible-boolean-)(boolean b)

Sets the visibility of the popup menu.

void

[show](../../javax/swing/JPopupMenu.html#show-java.awt.Component-int-int-)([Component](../../java/awt/Component.html "class in java.awt") invoker, int x, int y)

Displays the popup menu at the position x,y in the coordinate space of the component invoker.

void

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

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