For a new NetBeans plugin of mine I was in the need to create a toggle-able action for the toolbar/menu. It took a while, but after some research I found the gem in the NetBeans API:
org.openide.util.actions.BooleanStateAction . Easy to use, once you know of its existence. I documented it at .
Using it you can create toolbar buttons like this, which behave like
Bonus: If you like to create a toggle-able Action, which is bound to a boolean value from a property file (/configuration file) then
org.openide.awt.Actions.checkbox  is the solution. An example can be found at