public class SwingFormAction extends AbstractAction implements FormAction
A Swing specific implementation of the FormAction
interface.
This class serves as an adapter between the generic FormAction
interface and Swing specific actions.
Modifier and Type | Field and Description |
---|---|
static String |
CHECKED
Constant for the CHECKED property.
|
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
SwingFormAction(String aName,
Object aTask)
Creates a new instance of
SwingFormAction and initializes
it. |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent event)
Callback method for action events.
|
void |
execute(BuilderEvent event)
Executes this action.
|
String |
getName()
Returns the name of this action.
|
Object |
getTask()
Returns the task of this action.
|
boolean |
isChecked()
Returns the value of the
checked property. |
void |
setChecked(boolean f)
Sets the value of the
checked property. |
void |
setTask(Object task)
Sets the task of this action.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEnabled, setEnabled
public static final String CHECKED
public SwingFormAction(String aName, Object aTask)
SwingFormAction
and initializes
it. The task is checked (using ActionHelper
)
whether it is of an allowed type.aName
- the name of the actionaTask
- the task with the executable codeIllegalArgumentException
- if the name is null or the task
is invalidpublic String getName()
getName
in interface FormAction
public boolean isChecked()
checked
property.isChecked
in interface FormAction
checked
property.public void setChecked(boolean f)
checked
property. This property is
used for checked menu items or toggle buttons in toolbars.setChecked
in interface FormAction
f
- the value of the propertypublic Object getTask()
getTask
in interface FormAction
public void setTask(Object task)
ActionHelper
is used.setTask
in interface FormAction
task
- the new taskIllegalArgumentException
- if the task object is not allowedpublic void execute(BuilderEvent event)
ActionHelper
class.execute
in interface FormAction
event
- the causing eventpublic void actionPerformed(ActionEvent event)
actionPerformed
in interface ActionListener
event
- the action eventCopyright © 2016 The JGUIraffe Team. All rights reserved.