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 .
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
).
For the sake of completeness I add the code fragment that solved my problem:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="OptionsDialog">
<folder name="Appearance">
<file name="org-netbeans-core-windows-options-LafOptionsPanelController.instance_hidden"/>
</folder>
<file name="Keymaps.instance_hidden"/>
</folder>
</filesystem>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.