org.pietschy.command.delegate
Class SwingActionDelegate
- ActionCommandExecutor
public class SwingActionDelegate
SwingActionDelete is an instance of
CommandDelegate
that invokes an existing swing action. This is
useful for mapping Commands to components that have built in actions.
Example.
CommandDelegate delgate = new SwingActionDelegate("copy-command", getActionMap(), "copy-to-clipboard")
The above example will invoke the "copy-to-clipboard" action when the "copy-command" is invoked.
SwingActionDelegate(String id, Action action) - Creates a new delegate with the specified id that invokes the specfied
javax.swing.Action .
|
SwingActionDelegate(String id, ActionMap actionMap, Object actionKey) - Creates a new delegate with the specified id that invokes the
javax.swing.Action in the
specified javax.swing.ActionMap with the specified action key.
|
addPropertyChangeListener , addPropertyChangeListener , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getId , getPropertyChangeListeners , getPropertyChangeListeners , isEnabled , removePropertyChangeListener , removePropertyChangeListener , setEnabled |
SwingActionDelegate
public SwingActionDelegate(String id,
Action action)
Creates a new delegate with the specified id that invokes the specfied javax.swing.Action
.
id
- the id of the delegate.action
- the javax.swing.Action
to invoke.
SwingActionDelegate
public SwingActionDelegate(String id,
ActionMap actionMap,
Object actionKey)
Creates a new delegate with the specified id that invokes the
javax.swing.Action
in the
specified
javax.swing.ActionMap
with the specified action key.
Example.
CommandDelegate delgate = new SwingActionDelegate("copy-command", getActionMap(), "copy-to-clipboard")
The above example will invoke the "copy-to-clipboard" action when the "copy-command" is invoked.
id
- the id of the delegate.actionMap
- the javax.swing.ActionMap
containing the Action.actionKey
- the actions key within the map.