java 如何从 netBeans 平台的菜单中删除项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2435153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove items from menu in netBeans platform?
提问by ahoj
I have module application. When I run it, the main window of that app has quite complex menu. How to remove some items from menu?
我有模块应用程序。当我运行它时,该应用程序的主窗口有相当复杂的菜单。如何从菜单中删除某些项目?
采纳答案by vkraemer
You can remove menu items from the menu bar by adding entries to your project's layer.xml file.
您可以通过向项目的 layer.xml 文件中添加条目来从菜单栏中删除菜单项。
You should read through 'Tweaking the User Interface' from the 'NetBeans Platform HTML Editor' tutorialto get a rough idea of what you will need to do.
您应该通读“NetBeans 平台 HTML 编辑器”教程中的“调整用户界面”以大致了解您需要做什么。
There is another tutorial-ish description of using the layer file to hide items, too.
回答by suresh rathnaraj
In netbeans 8.0 , the layer file is generated when ever a module contains 'configuration type' annonations in java code, for example a module with top component. The generated layer.xml is located at build directory classes/META-INF/generated-layer.xml. However, the generated-layer.xml is not editable. To hide/show menubar / tool bar, click on the module, click other and add XML layer file. Now under the important files you can see XML layer. Expand it. Now expand . Expand the "Menu Bar". Delete the menu bar which you don't want.
在 netbeans 8.0 中,当模块在 java 代码中包含“配置类型”注解时,就会生成层文件,例如具有顶级组件的模块。生成的 layer.xml 位于构建目录 classes/META-INF/generated-layer.xml。但是,生成的layer.xml 是不可编辑的。要隐藏/显示菜单栏/工具栏,请单击模块,单击其他并添加 XML 图层文件。现在在重要文件下您可以看到 XML 层。展开它。现在展开。展开“菜单栏”。删除您不想要的菜单栏。
回答by johnstosh
The easier way appears to be, as Martin Krauskopf wrote:
更简单的方法似乎是,正如 Martin Krauskopf 所写:
Just go to:
只需前往:
Projects view (Ctrl-1)>>your module>>Important Files>>XML Layer>>Menu Bar>>Help
项目视图 (Ctrl-1) >>您的模块>>重要文件>> XML 层>>菜单栏>>帮助
and delete what you want (it will actually generate appropriate content in layer.xml of the module).
并删除您想要的内容(它实际上会在模块的 layer.xml 中生成适当的内容)。
回答by setzamora
You can remove it in layer.xml
您可以在 layer.xml 中删除它
layer in context - Menu Bar
上下文中的图层 - 菜单栏
here's the link
这是链接

