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

e812. 强制弹出菜单为重组件的更多相关文章

  1. [Flex] 组件Tree系列 —— 作为PopUpButton的弹出菜单

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:Tree作为PopUpButton ...

  2. iOS开发——动画篇Swift篇&炫酷弹出菜单

    炫酷弹出菜单   这个是一个第三方按钮菜单组件,原版是使用Objective-C编写的名为AwesomeMenu的组件,地址是:https://github.com/levey/AwesomeMenu ...

  3. 如何利用PopupWindow实现弹出菜单并解决焦点获取以及与软键盘冲突问题

    如何利用PopupWindow实现弹出菜单并解决焦点获取以及与软键盘冲突问题 如何利用PopupWindow实现弹出菜单并解决焦点获取以及与软键盘冲突问题 在android中有时候可能要实现一个底部弹 ...

  4. Delphi XE7实现的任意位置弹出菜单

    Delphi XE7中目前还没有弹出菜单组件,这个弹出菜单应用很普遍,在JAVA开发的安卓程序中很简单就可以用上了,应该说是一个标准控件.看了一些例子,但是都不能满足我想在任意位置弹出菜单需求,于是自 ...

  5. Vue2的右键弹出菜单(vue-contextmenu)

    给大家推荐一个基于Vue2的右键弹出菜单插件,支持单一SPA页面以及可以在循环绑定中使用. 项目地址为:https://github.com/chIIC/vue-...demo1: 父组件绑定右键事件 ...

  6. 向上弹出菜单jQuery插件

    插件名:柯乐义英文名:Keleyijs文件名称:jquery.keleyi.js插件功能:该插件可以让你轻易地在页面上构建一个向上弹出的二级菜单. 示例查看:http://keleyi.com/kel ...

  7. html5手机端遮罩弹出菜单代码

    效果体验:http://hovertree.com/texiao/html5/17/ 效果图: 代码如下: <!doctype html> <html lang="zh&q ...

  8. DIV+CSS制作二级横向弹出菜单,略简单

    没有使用JavaScript控制二级菜单的显示,结果如上图所示. 代码如下: <!DOCTYPE html> <html> <head> <meta char ...

  9. vc++ 如何添加右键弹出菜单

    一.创建新工程 二.编辑菜单资源 1.添加菜单 按"Ctrl+R",双击"Menu"图标 2.于菜单编辑器内编辑菜单 四.添加代码(红色部分) void CCM ...

随机推荐

  1. [MyBean-说明书]关于插件的单件模式(singleton),插件的共享模式

    [说明] 单件模式是一种用于确保整个应用程序中只有一个类实例. 想想我们的系统中有哪些方面可以应用到单件模式,比如大家常说的连接(ADOConnection)共享,其实就是指的单件模式. [MyBea ...

  2. 【ARM】arm异常中断处理知识点

    ARM处理器7种类型异常 按优先级从高到低的排列如下: 复位异常(Reset) 数据异常(Date Abort) 快速中断异常(FIQ) 外部中断异常(IRQ) 预取异常(Prefetch Abort ...

  3. 【转】31个实用的find命令

    find . -name "*.sql" -exec md5sum {} \; 一.主要内容 ====================================== . 用文 ...

  4. iOS开发中的压缩以及解压

    事实上,在iOS开发中,压缩与解压,我都是采用第三方框架SSZipArchive实现的 gitHub地址:   https://github.com/ZipArchive/ZipArchive 上面有 ...

  5. shell 删除文件过期文件

    删除创建时间大于30天的文件 find /archivelog -ctime + | xargs rm -rf -amin n #查找系统中最后N分钟访问的文件 -atime n #查找系统中最后n* ...

  6. C#学习笔记(3)——操作sqlserver数据库增删改查

    说明(2017-5-25 16:29:35): 1. VS2010,视图->服务器资源管理器->数据连接->右键添加连接->服务器名(本机可以用点)->选择数据库-> ...

  7. 基于jQuery图片自适应排列显示代码

    基于jQuery图片自适应排列显示代码.这是一款基于jquery.flex-images插件实现的类似谷歌图片流效果.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div ...

  8. kali Rolling安装之后的一些常用配置总结(更新)

    原文: https://ssooking.github.io/kali-rolling-an-zhuang-zhi-hou-de-yi-xie-chang-yong-pei-zhi-zong-jie/ ...

  9. === $ spark sql 的特别的方法

    /** * Equality test. * {{{ * // Scala: * df.filter( df("colA") === df("colB") ) ...

  10. Java heap space cdh 5.11.1

    在执行hive count 查询的时候报错:Error: Java heap space 解决办法是 set io.sort.mb=10; 执行hadoop的Exeample的时候报错,也是java ...