Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

java - NetBeans Platform: How to disable specific options dialog categories?

I have to program a fat client using NetBeans Platform and JavaFX 11. One of the requirements is to offer a default and dark theme mode for the whole application and to remove the option dialog category Keymaps and the sub category Look and Feel inside the Appearance category. I searched the web for the appropriate API, but found only an API to add new (sub) categories to the options dialog. enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Like often in the Netbeans platform, customization is done by editing a layer.xml file, where you can add stuff but also override the global configuration.

If you don't already have one, create a XML Layer file in one of your modules: right-click menu New > Module Development > XML Layer.

The file will appear in the Important Files folder of the module.

Expand the Layer.xml node and you see <this layer> and <this layer in context>. The first one shows only the changes present in your file. The second one shows the same thing, but in the global context: the changes present in your file appear in bold, and the rest is the global configuration.

Expand OptionsDialog, and if you don't want the General panel, then select General and delete. This will replace the item with a "hidden" instance.

In the tutorial you mention, they use annotation in the code to add an entry in the layer.xml file.

You'll see other nodes like Menu Bar, where it's the same principle: you can remove unwanted menu entries, or add new ones (directly in the layer.xml, but much preferably using annotations like ActionReference).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...