To display JPopupMenu on an AWT component : JPopupMenu « Swing « Java Tutorial






If you need to enable the display of a Panel (an AWT component), you can configure it at the individual JPopupMenu level or for your entire applet or application. At the individual pop-up level, just set the lightWeightPopupEnabled property to false.

The setInheritsPopupMenu() method accepts a boolean argument. When true, and no component pop-up menu has been directly set for the component, the parent container will be explored for a pop-up.

At the system level, this is done as follows:

// From now on, all JPopupMenus will be heavyweight
JPopupMenu.setDefaultLightWeightPopupEnabled(false);








14.26.JPopupMenu
14.26.1.Creating a Popup Menu
14.26.2.Creating a Popup Menu with Nested Menus
14.26.3.Forcing a Popup Menu to Be a Heavyweight Component
14.26.4.Force the popup menu of a JMenu to be heavyweight:
14.26.5.To display JPopupMenu on an AWT component
14.26.6.JPopupMenu: the container for pop-up menu componentsJPopupMenu: the container for pop-up menu components
14.26.7.Adding action listener to popup menuitemAdding action listener to popup menuitem
14.26.8.Using PopupMenuListenerUsing PopupMenuListener
14.26.9.Customizing JPopupMenu Look and Feel