Mega Code Archive

 
Categories / Java Tutorial / Swing
 

To display JPopupMenu on an AWT component

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);