zoukankan      html  css  js  c++  java
  • e812. 强制弹出菜单为重组件

    By default, Swing popup menus used by JMenu and JPopupMenu are lightweight. If heavyweight components are used in the same frame, the popup menus may appear behind the heavyweight components.

    This example demonstrates how to force a JPopupMenu to use heavyweight components:

        JPopupMenu popupMenu = new JPopupMenu();
        
        // Retrieve current setting
        boolean lwPopup = popupMenu.isLightWeightPopupEnabled(); // true
        
        // Force the popup menu to use heavyweight components
        popupMenu.setLightWeightPopupEnabled(false);
        // To use the popup menu, see e810 Creating a Popup Menu
    
    

    This example demonstrates how to force the popup menu of a JMenu to be heavyweight:

        // Create a menu with a menu item
        JMenu menu = new JMenu("Menu Label");
        menu.add(new JMenuItem("Item Label"));
        
        // Retrieve current setting
        lwPopup = menu.getPopupMenu().isLightWeightPopupEnabled(); // true
        
        // Force the menu's popup menu to be heavyweight
        menu.getPopupMenu().setLightWeightPopupEnabled(false);
        // To use the menu, see e808 建立菜单栏,菜单,菜单项
    
    

    This example configures all popup menus to be heavyweight:

        // Retrieve current setting
        lwPopup = JPopupMenu.getDefaultLightWeightPopupEnabled(); // true
        
        // Globally use heavyweight components for all popup menus
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    
    Related Examples
  • 相关阅读:
    excel的导入导出
    mybatis常用sql
    java中和时间相关的类,方法
    <resultMap>
    项目启动报的错
    多表查询
    file的一些方法
    AOV网络与AOE网络
    封装解封装过程
    以太网交换机
  • 原文地址:https://www.cnblogs.com/borter/p/9596174.html
Copyright © 2011-2022 走看看