Force the popup menu of a JMenu to be heavyweight : Popup menu « Swing JFC « Java






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

   
  








Related examples in the same category

1.Creating a Popup Menu
2.A popup menu is sometimes called a context menu
3.Creating a Popup Menu with Nested Menus
4.JPopupMenu with mouse event
5.set Component Popup Menu
6.Forcing a Popup Menu to Be a Heavyweight Component
7.Configure all popup menus to be heavyweight
8.setInheritsPopupMenu