Save This Page
Home » openjdk-7 » java » awt » [javadoc | source]
java.awt
public class: PopupMenu [javadoc | source]
java.lang.Object
   java.awt.MenuComponent
      java.awt.MenuItem
         java.awt.Menu
            java.awt.PopupMenu

All Implemented Interfaces:
    MenuContainer, Accessible, Serializable

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.

Nested Class Summary:
protected class  PopupMenu.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. 

Field Summary
static  int nameCounter     
transient  boolean isTrayIconPopup     
Fields inherited from java.awt.Menu:
items,  tearOff,  isHelpMenu
Fields inherited from java.awt.MenuItem:
enabled,  label,  actionCommand,  eventMask,  actionListener
Fields inherited from java.awt.MenuComponent:
peer,  parent,  appContext,  font,  newEventsOnly,  actionListenerK,  itemListenerK,  accessibleContext
Constructor:
 public PopupMenu() throws HeadlessException 
    Creates a new popup menu with an empty name.
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
 public PopupMenu(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.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
Method from java.awt.PopupMenu Summary:
addNotify,   constructComponentName,   getAccessibleContext,   getParent,   show
Methods from java.awt.Menu:
add,   add,   addNotify,   addSeparator,   constructComponentName,   countItems,   countItemsImpl,   deleteShortcut,   getAccessibleChildIndex,   getAccessibleContext,   getItem,   getItemCount,   getItemImpl,   getShortcutMenuItem,   handleShortcut,   insert,   insert,   insertSeparator,   isTearOff,   paramString,   remove,   remove,   removeAll,   removeNotify,   shortcuts
Methods from java.awt.MenuItem:
addActionListener,   addNotify,   constructComponentName,   deleteShortcut,   deleteShortcut,   disable,   disableEvents,   doMenuEvent,   enable,   enable,   enableEvents,   eventEnabled,   getAccessibleContext,   getActionCommand,   getActionCommandImpl,   getActionListeners,   getLabel,   getListeners,   getShortcut,   getShortcutMenuItem,   handleShortcut,   isEnabled,   paramString,   processActionEvent,   processEvent,   removeActionListener,   setActionCommand,   setEnabled,   setLabel,   setShortcut
Methods from java.awt.MenuComponent:
constructComponentName,   dispatchEvent,   dispatchEventImpl,   eventEnabled,   getAccessControlContext,   getAccessibleChildIndex,   getAccessibleContext,   getAccessibleIndexInParent,   getAccessibleStateSet,   getFont,   getFont_NoClientCode,   getName,   getParent,   getParent_NoClientCode,   getPeer,   getTreeLock,   paramString,   postEvent,   processEvent,   removeNotify,   setFont,   setName,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.awt.PopupMenu Detail:
 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.
 String constructComponentName() 
    Constructs a name for this MenuComponent. Called by getName when the name is null.
 public AccessibleContext getAccessibleContext() 
    Gets the AccessibleContext associated with this PopupMenu.
 public MenuContainer getParent() 
    {@inheritDoc}
 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.