Swing:画布重叠菜单 [英] Swing: Canvas overlaps menu

查看:34
本文介绍了Swing:画布重叠菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有菜单栏和覆盖所有剩余表面的画布的 JFrame.当我点击菜单栏时,菜单在画布后面打开,但我看不到它.有没有人经历过这个?除了调整 Canvas 的大小(我不愿意这样做)之外,还有其他解决方案吗?

I have a JFrame with a menu bar and a canvas covering all the remaining surface. When I click on the menu bar, the menu opens behind the Canvas and I can't see it. Has anyone experienced this? Other than resizing the Canvas (which I am reluctant to do) is there any solution?

谢谢,
弗拉德

Thanks,
Vlad

推荐答案

您遇到了重量级与轻量级的问题.

You're experiencing heavyweight vs. lightweight issues.

快速修复:

// Call this sometime before you use your menus 
JPopupMenu.setDefaultLightWeightPopupEnabled(false)

重量级与轻量级

这篇关于Swing:画布重叠菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆