[英]Get rid of sub menu in Java Swing using Windows builder
I am trying to learn Java Swing and Windows Builder by creating a personal project. 我正在尝试通过创建个人项目来学习Java Swing和Windows Builder。 I added a menu bar File, Edit, View, Help etc. When I click on 'File' I get Open,Save,Save As. 我添加了一个菜单栏“文件”,“编辑”,“视图”,“帮助”等。当我单击“文件”时,我会打开,保存,另存为。 This is also correct. 这也是正确的。 But using the default options in Windows Builder, Gives me a sub menu under 'Open' indicated by an arrow but I don't want this all I want is: 但是,使用Windows Builder中的默认选项,在箭头所示的“打开”下给我一个子菜单,但是我不想要这就是:
File - Open - Save - Save As 文件-打开-保存-另存为
And I want to get rid of 我想摆脱
File - Open ->NULL (this is what comes as default in Windows builder) 文件-打开-> NULL(这是Windows构建器中的默认值)
You probably added an "Open" JMenu
, instead of adding an "Open" JMenuItem
. 您可能添加了“ Open” JMenu
,而不是添加了“ Open” JMenuItem
。 The source code would confirm it. 源代码将确认它。
JMenuItem
is a leaf in the menu tree. JMenuItem
是菜单树中的叶子。 JMenu
is a container for other JMenu
s and JMenuItem
s. JMenu
是其他JMenu
和JMenuItem
的容器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.