Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Force the popup menu of a JMenu to be heavyweight

import javax.swing.JMenu; import javax.swing.JMenuItem; public class Main {   public static void main(String[] argv) throws Exception {     JMenu menu = new JMenu("Menu Label");     menu.add(new JMenuItem("Item Label"));     boolean lwPopup = menu.getPopupMenu().isLightWeightPopupEnabled(); // true     menu.getPopupMenu().setLightWeightPopupEnabled(false);   } }