Toggle SimpleButtonAction

I have a Dockable with a menu bar made of some SimpleButtonAction.

I created a

DefaultDockActionSource actions = new DefaultDockActionSource( new LocationHint( LocationHint.DOCKABLE, LocationHint.LEFT ));

so I can add the buttons like this:

actions.add(button1);

I need to toggle the button, so it is clear that it has been pressed or not, like in a “show grid” button for example. I know JToggleButton, but it can’t be added to the DefaultDockActionSource.

Any help?

You could use a “SimpleSelectableAction.Check” instead. This is another action, it looks like a button but behaves like a JCheckBox (in a popup menu it will show up as JCheckBoxMenuItem).