Actions manager.addAction(action); // Change the state of the action: manager.setEnabled("new-action", newState); The ActionManager also supports Actions that can have a selected state associated with them. These Actions are typically represented by a JCheckBox or similar widget. For such actions the registered method is invoked with an additional parameter indicating the selected state of the widget. For example, for the callback handler:
public class Handler { public void stateChanged(boolean newState); }
The registration method would look similar:
manager.registerCallback("select-action", new Handler(), "stateChanged");
The stateChanged method would be invoked as the selected state of the widget changed. Additionally if you need to change the selected state of the Action use the ActionManager method setSelected
.
The ActionContainerFactory
uses the managed Actions in a ActionManager to create user interface components. It uses the shared instance of ActionManager by default. For example, to create a JMenu based on an action-list id:
ActionContainerFactory factory = new ActionContainerFactory(); JMenu file = factory.createMenu(list);
@see ActionContainerFactory
@see TargetableAction
@see BoundAction
@author Mark Davidson
@author Neil Weber