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. Cloud Resource

    Cloud Public Cloud Aliyun AWS Azure Cloud Stack SDN指南 DNS:Band Private Cloud DC/OS OpenStack Hybrid ...

  2. Python fabric实践操作

    前面学习了理论,下面该练练手了.两台机器:10.1.6.186.10.1.6.159.fabric部署在10.1.6.186上面. 1  执行一个简单的task任务,显示两台机器的/home/guol ...

  3. (转)Go和HTTPS

    转自:http://studygolang.com/articles/2946 Go和HTTPS  2015-04-30   bigwhite  阅读 5688 次   4 人喜欢  3 条评论  收 ...

  4. 21、uwp UI自动化测试(WinAppDriver)

    使用 UI自动化测试的好处就是在代码逻辑中写好 case 后,来实现 “一劳永逸” 的作用,并且自动化测试能够模拟人工达不到要求,比如快速切换页面.快速点击按钮等,对于提高软件的稳定性很有帮助. 安装 ...

  5. 17、uwp 打包失败记录

    今天在打包时,总是打包失败, visual studio 报错误: 严重性 说明 代码 项目 文件 行 禁止显示状态错误 Error info: error 80080204: All app pac ...

  6. position: absolute;

    .recent-contac { position: absolute; overflow: auto; overflow-x: hidden; top: -2px; bottom: 0; -webk ...

  7. 如何在Oracle中一次执行多条sql语句 (.net C#)

    关键是不能换行,要加上begin ...sql... end;     每个SQL用:隔开,end后面必须加: 以下是拷贝于:http://www.cnblogs.com/teamleader/arc ...

  8. IE 此网站的某个加载项无法运行

    1.使用IE浏览器 发生问题,一直以为是浏览器安全设置出问题,将IE安全级别调到最低,还是同样的问题 2.转用360浏览器(IE内核) 问题一样,提示略有不同 点击需要运行的java程序 解决方法 1 ...

  9. LeetCode: Largest Rectangle in Histogram 解题报告

    Largest Rectangle in Histogram Given n non-negative integers representing the histogram's bar height ...

  10. Python给我的小伙伴来个微信机器人

    [本文出自天外归云的博客园] 安装wxpy 首先你得去图灵机器人官网上注册个账号,登录后在机器人设置里面会有一个api_key,下文会用到! 然后说开发环境,我用的是python3环境,事先需要安装一 ...