Example usage for Java javax.swing JPopupMenu fields, constructors, methods, implement or subclass
The text is from its open source code.
JPopupMenu() Constructs a JPopupMenu without an "invoker". | |
JPopupMenu(String label) Constructs a JPopupMenu with the specified title. |
JMenuItem | add(JMenuItem menuItem) Appends the specified menu item to the end of this menu. |
JMenuItem | add(String s) Creates a new menu item with the specified text and appends it to the end of this menu. |
JMenuItem | add(Action a) Appends a new menu item to the end of the menu which dispatches the specified Action object. |
Component | add(String name, Component comp) Adds the specified component to this container. |
void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addMenuKeyListener(MenuKeyListener l) Adds a MenuKeyListener to the popup menu. |
void | addPopupMenuListener(PopupMenuListener l) Adds a PopupMenu listener. |
void | addSeparator() Appends a new separator at the end of the menu. |
void | applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it. |
void | doLayout() Causes this container to lay out its components. |
Component | getComponent(int n) Gets the nth component in this container. |
int | getComponentCount() Gets the number of components in this panel. |
Component[] | getComponents() Gets all the components in this container. |
boolean | getDefaultLightWeightPopupEnabled() Gets the defaultLightWeightPopupEnabled property, which by default is true . |
FontMetrics | getFontMetrics(Font font) Gets the FontMetrics for the specified Font . |
int | getHeight() Returns the current height of this component. |
Component | getInvoker() Returns the component which is the 'invoker' of this popup menu. |
Container | getParent() Gets the parent of this component. |
Dimension | getPreferredSize() If the preferredSize has been set to a non-null value just returns it. |
MenuElement[] | getSubElements() Returns an array of MenuElement s containing the submenu for this menu component. |
void | insert(Action a, int index) Inserts a menu item for the specified Action object at a given position. |
void | insert(Component component, int index) Inserts the specified component into the menu at a given position. |
boolean | isLightWeightPopupEnabled() Gets the lightWeightPopupEnabled property. |
boolean | isShowing() Determines whether this component is showing on screen. |
boolean | isVisible() Returns true if the popup menu is visible (currently being displayed). |
void | pack() Lays out the container so that it uses the minimum space needed to display its contents. |
void | remove(int pos) Removes the component at the specified index from this popup menu. |
void | removeAll() Removes all the components from this container. |
void | removeFocusListener(FocusListener l) Removes the specified focus listener so that it no longer receives focus events from this component. |
void | repaint() Repaints this component. |
void | revalidate() Supports deferred automatic layout. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setDefaultLightWeightPopupEnabled(boolean aFlag) Sets the default value of the lightWeightPopupEnabled property. |
void | setInvoker(Component invoker) Sets the invoker of this popup menu -- the component in which the popup menu menu is to be displayed. |
void | setLabel(String label) Sets the popup menu's label. |
void | setLayout(LayoutManager mgr) Sets the layout manager for this container. |
void | setLightWeightPopupEnabled(boolean aFlag) Sets the value of the lightWeightPopupEnabled property, which by default is true . |
void | setLocation(int x, int y) Sets the location of the upper left corner of the popup menu using x, y coordinates. |
void | setLocation(Point p) Moves this component to a new location. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setSize(int width, int height) Resizes this component so that it has width width and height height . |
void | setVisible(boolean b) Sets the visibility of the popup menu. |
void | show(Component invoker, int x, int y) Displays the popup menu at the position x,y in the coordinate space of the component invoker. |