Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
Sample
Document
Class java.awt.PopupMenu
Inherited members: ShowHide
Deprecated: ShowHide
View: ClientSubclassPackageImplementation
java.awt

Class PopupMenu

  • java.lang.Object
    • java.awt.MenuComponent
      • java.awt.MenuItem
        • java.awt.Menu
          • java.awt.PopupMenu
  • All Implemented Interfaces:
    MenuContainer, java.io.Serializable, javax.accessibility.Accessible
    public class PopupMenu extends Menu
    A class that implements a menu which can be dynamically popped up at a specified position within a component.

    As the inheritance hierarchy implies, a PopupMenu can be used anywhere a Menu can be used. However, if you use a PopupMenu like a Menu (e.g., you add it to a MenuBar), then you cannot call show on that PopupMenu.

    See Also:
    Serialized Form
    • Nested Classes 
      Modifier and Type Class and Description
      Inherited member indicator AccessibleAWTMenu Reveal DetailHide Detail
      protected class AccessibleAWTMenu
      Inner class of Menu used to provide default support for accessibility.
      protected class AccessibleAWTMenu
      Inner class of Menu used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by menu component developers.

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

      Since:
      1.3
      See Also:
      Serialized Form
      Inherited member indicator AccessibleAWTMenuComponent Reveal DetailHide Detail
      protected class AccessibleAWTMenuComponent
      Inner class of MenuComponent used to provide default support for accessibility.
      protected class AccessibleAWTMenuComponent
      Inner class of MenuComponent used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by menu component developers.

      The class used to obtain the accessible role for this object.

      Since:
      1.3
      See Also:
      Serialized Form
      Inherited member indicator AccessibleAWTMenuItem Reveal DetailHide Detail
      protected class AccessibleAWTMenuItem
      Inner class of MenuItem used to provide default support for accessibility.
      protected class AccessibleAWTMenuItem
      Inner class of MenuItem used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by menu component developers.

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

      Since:
      1.3
      See Also:
      Serialized Form
      Ordinary member indicator AccessibleAWTPopupMenu Reveal DetailHide Detail
      protected class AccessibleAWTPopupMenu
      Inner class of PopupMenu used to provide default support for accessibility.
      protected class AccessibleAWTPopupMenu
      Inner class of PopupMenu used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by menu component developers.

      The class used to obtain the accessible role for this object.

      Since:
      1.3
      See Also:
      Serialized Form
    • Constructors 
      Constructor and Description
      Ordinary member indicator PopupMenu Reveal DetailHide Detail
      PopupMenu()
      Creates a new popup menu with an empty name.
      public PopupMenu() throws HeadlessException
      Creates a new popup menu with an empty name.
      Throws:
      HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
      See Also:
      GraphicsEnvironment.isHeadless()
      Ordinary member indicator PopupMenu Reveal DetailHide Detail
      PopupMenu(java.lang.String label)
      Creates a new popup menu with the specified name.
      public PopupMenu(java.lang.String label) throws HeadlessException
      Creates a new popup menu with the specified name.
      Parameters:
      label - a non-null string specifying the popup menu's label
      Throws:
      HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
      See Also:
      GraphicsEnvironment.isHeadless()
    • Methods 
      Modifier and Type Method and Description
      Inherited member indicator add Reveal DetailHide Detail
      MenuItem add(MenuItem mi)
      Adds the specified menu item to this menu.
      public MenuItem add(MenuItem mi)
      Description copied from class: Menu
      Adds the specified menu item to this menu. If the menu item has been part of another menu, removes it from that menu.
      Parameters:
      mi - the menu item to be added
      Returns:
      the menu item added
      See Also:
      Menu.insert(java.lang.String, int), Menu.insert(java.awt.MenuItem, int)
      Inherited member indicator add Reveal DetailHide Detail
      void add(java.lang.String label)
      Adds an item with the specified label to this menu.
      public void add(java.lang.String label)
      Description copied from class: Menu
      Adds an item with the specified label to this menu.
      Parameters:
      label - the text on the item
      See Also:
      Menu.insert(java.lang.String, int), Menu.insert(java.awt.MenuItem, int)
      Inherited member indicator addActionListener Reveal DetailHide Detail
      void addActionListener(ActionListener l)
      Adds the specified action listener to receive action events from this menu item.
      public void addActionListener(ActionListener l)
      Description copied from class: MenuItem
      Adds the specified action listener to receive action events from this menu item. If l is null, no exception is thrown and no action is performed.

      Refer to AWT Threading Issues for details on AWT's threading model.

      Parameters:
      l - the action listener.
      Since:
      JDK1.1
      See Also:
      MenuItem.removeActionListener(java.awt.event.ActionListener), MenuItem.getActionListeners(), ActionEvent, ActionListener
      Overridden member indicator addNotify Reveal DetailHide Detail
      void addNotify()
      Creates the popup menu's peer.
      public void addNotify()
      Creates the popup menu's peer. The peer allows us to change the appearance of the popup menu without changing any of the popup menu's functionality.
      Overrides:
      addNotify in class Menu
      Inherited member indicator addSeparator Reveal DetailHide Detail
      void addSeparator()
      Adds a separator line, or a hypen, to the menu at the current position.
      public void addSeparator()
      Description copied from class: Menu
      Adds a separator line, or a hypen, to the menu at the current position.
      See Also:
      Menu.insertSeparator(int)
      Inherited member indicator countItems Reveal DetailHide Detail
      int countItems()
      Deprecated. As of JDK version 1.1, replaced by getItemCount().
      @Deprecated public int countItems()
      Deprecated. As of JDK version 1.1, replaced by getItemCount().
      Inherited member indicator deleteShortcut Reveal DetailHide Detail
      void deleteShortcut()
      Delete any MenuShortcut object associated with this menu item.
      public void deleteShortcut()
      Description copied from class: MenuItem
      Delete any MenuShortcut object associated with this menu item.
      Since:
      JDK1.1
      Inherited member indicator disable Reveal DetailHide Detail
      void disable()
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      @Deprecated public void disable()
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      Inherited member indicator disableEvents Reveal DetailHide Detail
      protected void disableEvents(long eventsToDisable)
      Disables event delivery to this menu item for events defined by the specified event mask parameter.
      protected final void disableEvents(long eventsToDisable)
      Description copied from class: MenuItem
      Disables event delivery to this menu item for events defined by the specified event mask parameter.
      Parameters:
      eventsToDisable - the event mask defining the event types
      Since:
      JDK1.1
      See Also:
      MenuItem.processEvent(java.awt.AWTEvent), MenuItem.enableEvents(long), Component.disableEvents(long)
      Inherited member indicator dispatchEvent Reveal DetailHide Detail
      void dispatchEvent(AWTEvent e)
      Delivers an event to this component or one of its sub components.
      public final void dispatchEvent(AWTEvent e)
      Description copied from class: MenuComponent
      Delivers an event to this component or one of its sub components.
      Parameters:
      e - the event
      Inherited member indicator enable Reveal DetailHide Detail
      void enable()
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      @Deprecated public void enable()
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      Inherited member indicator enable Reveal DetailHide Detail
      void enable(boolean b)
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      @Deprecated public void enable(boolean b)
      Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
      Inherited member indicator enableEvents Reveal DetailHide Detail
      protected void enableEvents(long eventsToEnable)
      Enables event delivery to this menu item for events to be defined by the specified event mask parameter
      protected final void enableEvents(long eventsToEnable)
      Description copied from class: MenuItem
      Enables event delivery to this menu item for events to be defined by the specified event mask parameter

      Since event types are automatically enabled when a listener for that type is added to the menu item, this method only needs to be invoked by subclasses of MenuItem which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.

      Parameters:
      eventsToEnable - the event mask defining the event types
      Since:
      JDK1.1
      See Also:
      MenuItem.processEvent(java.awt.AWTEvent), MenuItem.disableEvents(long), Component.enableEvents(long)
      Overridden member indicator getAccessibleContext Reveal DetailHide Detail
      javax.accessibility.AccessibleContext getAccessibleContext()
      Gets the AccessibleContext associated with this PopupMenu.
      public javax.accessibility.AccessibleContext getAccessibleContext()
      Gets the AccessibleContext associated with this PopupMenu.
      Specified by:
      getAccessibleContext in interface javax.accessibility.Accessible
      Overrides:
      getAccessibleContext in class Menu
      Returns:
      the AccessibleContext of this PopupMenu
      Since:
      1.3
      Inherited member indicator getActionCommand Reveal DetailHide Detail
      java.lang.String getActionCommand()
      Gets the command name of the action event that is fired by this menu item.
      public java.lang.String getActionCommand()
      Description copied from class: MenuItem
      Gets the command name of the action event that is fired by this menu item.
      Since:
      JDK1.1
      See Also:
      MenuItem.setActionCommand(java.lang.String)
      Inherited member indicator getActionListeners Reveal DetailHide Detail
      ActionListener[] getActionListeners()
      Returns an array of all the action listeners registered on this menu item.
      public ActionListener[] getActionListeners()
      Description copied from class: MenuItem
      Returns an array of all the action listeners registered on this menu item.
      Returns:
      all of this menu item's ActionListeners or an empty array if no action listeners are currently registered
      Since:
      1.4
      See Also:
      MenuItem.addActionListener(java.awt.event.ActionListener), MenuItem.removeActionListener(java.awt.event.ActionListener), ActionEvent, ActionListener
      Inherited member indicator getFont Reveal DetailHide Detail
      Font getFont()
      Gets the font used for this menu component.
      public Font getFont()
      Description copied from class: MenuComponent
      Gets the font used for this menu component.
      Returns:
      the font used in this menu component, if there is one; null otherwise
      See Also:
      MenuComponent.setFont(java.awt.Font)
      Inherited member indicator getItem Reveal DetailHide Detail
      MenuItem getItem(int index)
      Gets the item located at the specified index of this menu.
      public MenuItem getItem(int index)
      Description copied from class: Menu
      Gets the item located at the specified index of this menu.
      Parameters:
      index - the position of the item to be returned.
      Returns:
      the item located at the specified index.
      Inherited member indicator getItemCount Reveal DetailHide Detail
      int getItemCount()
      Get the number of items in this menu.
      public int getItemCount()
      Description copied from class: Menu
      Get the number of items in this menu.
      Returns:
      the number of items in this menu.
      Since:
      JDK1.1
      Inherited member indicator getLabel Reveal DetailHide Detail
      java.lang.String getLabel()
      Gets the label for this menu item.
      public java.lang.String getLabel()
      Description copied from class: MenuItem
      Gets the label for this menu item.
      Returns:
      the label of this menu item, or null if this menu item has no label.
      Since:
      JDK1.0
      See Also:
      MenuItem.setLabel(java.lang.String)
      Inherited member indicator getListeners Reveal DetailHide Detail
      <T extends java.util.EventListener> T[] getListeners(java.lang.Class<T> listenerType)
      Returns an array of all the objects currently registered as FooListeners upon this MenuItem.
      public <T extends java.util.EventListener> T[] getListeners(java.lang.Class<T> listenerType)
      Description copied from class: MenuItem
      Returns an array of all the objects currently registered as FooListeners upon this MenuItem. FooListeners are registered using the addFooListener method.

      You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a MenuItem m for its action listeners with the following code:

      ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));
      If no such listeners exist, this method returns an empty array.
      Parameters:
      listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
      Returns:
      an array of all objects registered as FooListeners on this menu item, or an empty array if no such listeners have been added
      Throws:
      java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
      Since:
      1.3
      See Also:
      MenuItem.getActionListeners()
      Inherited member indicator getName Reveal DetailHide Detail
      java.lang.String getName()
      Gets the name of the menu component.
      public java.lang.String getName()
      Description copied from class: MenuComponent
      Gets the name of the menu component.
      Returns:
      the name of the menu component
      Since:
      JDK1.1
      See Also:
      MenuComponent.setName(java.lang.String)
      Overridden member indicator getParent Reveal DetailHide Detail
      MenuContainer getParent()
      Returns the parent container for this menu component.
      public MenuContainer getParent()
      Returns the parent container for this menu component.
      Overrides:
      getParent in class MenuComponent
      Returns:
      the menu component containing this menu component, or null if this menu component is the outermost component, the menu bar itself
      Inherited member indicator getPeer Reveal DetailHide Detail
      java.awt.peer.MenuComponentPeer getPeer()
      Deprecated. As of JDK version 1.1, programs should not directly manipulate peers.
      @Deprecated public java.awt.peer.MenuComponentPeer getPeer()
      Deprecated. As of JDK version 1.1, programs should not directly manipulate peers.
      Inherited member indicator getShortcut Reveal DetailHide Detail
      MenuShortcut getShortcut()
      Get the MenuShortcut object associated with this menu item,
      public MenuShortcut getShortcut()
      Description copied from class: MenuItem
      Get the MenuShortcut object associated with this menu item,
      Returns:
      the menu shortcut associated with this menu item, or null if none has been specified.
      Since:
      JDK1.1
      See Also:
      MenuItem.setShortcut(java.awt.MenuShortcut)
      Inherited member indicator getTreeLock Reveal DetailHide Detail
      protected java.lang.Object getTreeLock()
      Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.
      protected final java.lang.Object getTreeLock()
      Description copied from class: MenuComponent
      Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.
      Returns:
      this component's locking object
      Inherited member indicator insert Reveal DetailHide Detail
      void insert(MenuItem menuitem, int index)
      Inserts a menu item into this menu at the specified position.
      public void insert(MenuItem menuitem, int index)
      Description copied from class: Menu
      Inserts a menu item into this menu at the specified position.
      Parameters:
      menuitem - the menu item to be inserted.
      index - the position at which the menu item should be inserted.
      Throws:
      java.lang.IllegalArgumentException - if the value of index is less than zero
      Since:
      JDK1.1
      See Also:
      Menu.add(java.lang.String), Menu.add(java.awt.MenuItem)
      Inherited member indicator insert Reveal DetailHide Detail
      void insert(java.lang.String label, int index)
      Inserts a menu item with the specified label into this menu at the specified position.
      public void insert(java.lang.String label, int index)
      Description copied from class: Menu
      Inserts a menu item with the specified label into this menu at the specified position. This is a convenience method for insert(menuItem, index).
      Parameters:
      label - the text on the item
      index - the position at which the menu item should be inserted
      Throws:
      java.lang.IllegalArgumentException - if the value of index is less than zero
      Since:
      JDK1.1
      See Also:
      Menu.add(java.lang.String), Menu.add(java.awt.MenuItem)
      Inherited member indicator insertSeparator Reveal DetailHide Detail
      void insertSeparator(int index)
      Inserts a separator at the specified position.
      public void insertSeparator(int index)
      Description copied from class: Menu
      Inserts a separator at the specified position.
      Parameters:
      index - the position at which the menu separator should be inserted.
      Throws:
      java.lang.IllegalArgumentException - if the value of index is less than 0.
      Since:
      JDK1.1
      See Also:
      Menu.addSeparator()
      Inherited member indicator isEnabled Reveal DetailHide Detail
      boolean isEnabled()
      Checks whether this menu item is enabled.
      public boolean isEnabled()
      Description copied from class: MenuItem
      Checks whether this menu item is enabled.
      Since:
      JDK1.0
      See Also:
      MenuItem.setEnabled(boolean)
      Inherited member indicator isTearOff Reveal DetailHide Detail
      boolean isTearOff()
      Indicates whether this menu is a tear-off menu.
      public boolean isTearOff()
      Description copied from class: Menu
      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.

      Returns:
      true if this is a tear-off menu; false otherwise.
      Inherited member indicator paramString Reveal DetailHide Detail
      java.lang.String paramString()
      Returns a string representing the state of this Menu.
      public java.lang.String paramString()
      Description copied from class: Menu
      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.
      Overrides:
      paramString in class MenuItem
      Returns:
      the parameter string of this menu
      Inherited member indicator postEvent Reveal DetailHide Detail
      boolean postEvent(Event evt)
      Deprecated. As of JDK version 1.1, replaced by dispatchEvent.
      @Deprecated public boolean postEvent(Event evt)
      Deprecated. As of JDK version 1.1, replaced by dispatchEvent.
      Description copied from class: MenuComponent
      Posts the specified event to the menu. This method is part of the Java 1.0 event system and it is maintained only for backwards compatibility. Its use is discouraged, and it may not be supported in the future.
      Parameters:
      evt - the event which is to take place
      Inherited member indicator processActionEvent Reveal DetailHide Detail
      protected void processActionEvent(ActionEvent e)
      Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects.
      protected void processActionEvent(ActionEvent e)
      Description copied from class: MenuItem
      Processes action events occurring on this menu item, by dispatching them to any registered ActionListener objects. This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

      • An ActionListener object is registered via addActionListener.
      • Action events are enabled via enableEvents.

      Note that if the event parameter is null the behavior is unspecified and may result in an exception.

      Parameters:
      e - the action event
      Since:
      JDK1.1
      See Also:
      ActionEvent, ActionListener, MenuItem.enableEvents(long)
      Inherited member indicator processEvent Reveal DetailHide Detail
      protected void processEvent(AWTEvent e)
      Processes events on this menu item.
      protected void processEvent(AWTEvent e)
      Description copied from class: MenuItem
      Processes events on this menu item. If the event is an instance of ActionEvent, it invokes processActionEvent, another method defined by MenuItem.

      Currently, menu items only support action events.

      Note that if the event parameter is null the behavior is unspecified and may result in an exception.

      Overrides:
      processEvent in class MenuComponent
      Parameters:
      e - the event
      Since:
      JDK1.1
      See Also:
      MenuItem.processActionEvent(java.awt.event.ActionEvent)
      Inherited member indicator remove Reveal DetailHide Detail
      void remove(int index)
      Removes the menu item at the specified index from this menu.
      public void remove(int index)
      Description copied from class: Menu
      Removes the menu item at the specified index from this menu.
      Parameters:
      index - the position of the item to be removed.
      Inherited member indicator remove Reveal DetailHide Detail
      void remove(MenuComponent item)
      Removes the specified menu item from this menu.
      public void remove(MenuComponent item)
      Description copied from class: Menu
      Removes the specified menu item from this menu.
      Specified by:
      remove in interface MenuContainer
      Parameters:
      item - the item to be removed from the menu. If item is null or is not in this menu, this method does nothing.
      Inherited member indicator removeActionListener Reveal DetailHide Detail
      void removeActionListener(ActionListener l)
      Removes the specified action listener so it no longer receives action events from this menu item.
      public void removeActionListener(ActionListener l)
      Description copied from class: MenuItem
      Removes the specified action listener so it no longer receives action events from this menu item. If l is null, no exception is thrown and no action is performed.

      Refer to AWT Threading Issues for details on AWT's threading model.

      Parameters:
      l - the action listener.
      Since:
      JDK1.1
      See Also:
      MenuItem.addActionListener(java.awt.event.ActionListener), MenuItem.getActionListeners(), ActionEvent, ActionListener
      Inherited member indicator removeAll Reveal DetailHide Detail
      void removeAll()
      Removes all items from this menu.
      public void removeAll()
      Description copied from class: Menu
      Removes all items from this menu.
      Since:
      JDK1.0.
      Inherited member indicator removeNotify Reveal DetailHide Detail
      void removeNotify()
      Removes the menu's peer.
      public void removeNotify()
      Description copied from class: Menu
      Removes the menu's peer. The peer allows us to modify the appearance of the menu without changing its functionality.
      Overrides:
      removeNotify in class MenuComponent
      Inherited member indicator setActionCommand Reveal DetailHide Detail
      void setActionCommand(java.lang.String command)
      Sets the command name of the action event that is fired by this menu item.
      public void setActionCommand(java.lang.String command)
      Description copied from class: MenuItem
      Sets the command name of the action event that is fired by this menu item.

      By default, the action command is set to the label of the menu item.

      Parameters:
      command - the action command to be set for this menu item.
      Since:
      JDK1.1
      See Also:
      MenuItem.getActionCommand()
      Inherited member indicator setEnabled Reveal DetailHide Detail
      void setEnabled(boolean b)
      Sets whether or not this menu item can be chosen.
      public void setEnabled(boolean b)
      Description copied from class: MenuItem
      Sets whether or not this menu item can be chosen.
      Parameters:
      b - if true, enables this menu item; if false, disables it.
      Since:
      JDK1.1
      See Also:
      MenuItem.isEnabled()
      Inherited member indicator setFont Reveal DetailHide Detail
      void setFont(Font f)
      Sets the font to be used for this menu component to the specified font.
      public void setFont(Font f)
      Description copied from class: MenuComponent
      Sets the font to be used for this menu component to the specified font. This font is also used by all subcomponents of this menu component, unless those subcomponents specify a different font.

      Some platforms may not support setting of all font attributes of a menu component; in such cases, calling setFont will have no effect on the unsupported font attributes of this menu component. Unless subcomponents of this menu component specify a different font, this font will be used by those subcomponents if supported by the underlying platform.

      Parameters:
      f - the font to be set
      See Also:
      MenuComponent.getFont(), Font.getAttributes(), TextAttribute
      Inherited member indicator setLabel Reveal DetailHide Detail
      void setLabel(java.lang.String label)
      Sets the label for this menu item to the specified label.
      public void setLabel(java.lang.String label)
      Description copied from class: MenuItem
      Sets the label for this menu item to the specified label.
      Parameters:
      label - the new label, or null for no label.
      Since:
      JDK1.0
      See Also:
      MenuItem.getLabel()
      Inherited member indicator setName Reveal DetailHide Detail
      void setName(java.lang.String name)
      Sets the name of the component to the specified string.
      public void setName(java.lang.String name)
      Description copied from class: MenuComponent
      Sets the name of the component to the specified string.
      Parameters:
      name - the name of the menu component
      Since:
      JDK1.1
      See Also:
      MenuComponent.getName()
      Inherited member indicator setShortcut Reveal DetailHide Detail
      void setShortcut(MenuShortcut s)
      Set the MenuShortcut object associated with this menu item.
      public void setShortcut(MenuShortcut s)
      Description copied from class: MenuItem
      Set the MenuShortcut object associated with this menu item. If a menu shortcut is already associated with this menu item, it is replaced.
      Parameters:
      s - the menu shortcut to associate with this menu item.
      Since:
      JDK1.1
      See Also:
      MenuItem.getShortcut()
      Ordinary member indicator show Reveal DetailHide Detail
      void show(Component origin, int x, int y)
      Shows the popup menu at the x, y position relative to an origin component.
      public void show(Component origin, int x, int y)
      Shows the popup menu at the x, y position relative to an origin component. The origin component must be contained within the component hierarchy of the popup menu's parent. Both the origin and the parent must be showing on the screen for this method to be valid.

      If this PopupMenu is being used as a Menu (i.e., it has a non-Component parent), then you cannot call this method on the PopupMenu.

      Parameters:
      origin - the component which defines the coordinate space
      x - the x coordinate position to popup the menu
      y - the y coordinate position to popup the menu
      Throws:
      java.lang.NullPointerException - if the parent is null
      java.lang.IllegalArgumentException - if this PopupMenu has a non-Component parent
      java.lang.IllegalArgumentException - if the origin is not in the parent's heirarchy
      java.lang.RuntimeException - if the parent is not showing on screen
      Inherited member indicator toString Reveal DetailHide Detail
      java.lang.String toString()
      Returns a representation of this menu component as a string.
      public java.lang.String toString()
      Description copied from class: MenuComponent
      Returns a representation of this menu component as a string.
      Overrides:
      toString in class java.lang.Object
      Returns:
      a string representation of this menu component
      • 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