public interface Action extends ActionListener
AbstractButton.setAction(Action)
Modifier and Type | Field and Description |
---|---|
static String |
ACCELERATOR_KEY
A key to access the
KeyStroke used as the accelerator for the
action. |
static String |
ACTION_COMMAND_KEY
A key to access the action command string for the action.
|
static String |
DEFAULT
A key to access the default property for the action (this is not used).
|
static String |
LONG_DESCRIPTION
A key to access the long description for the action.
|
static String |
MNEMONIC_KEY
A key to access the mnemonic for the action.
|
static String |
NAME
A key to access the name for the action.
|
static String |
SHORT_DESCRIPTION
A key to access the short description for the action (the short
description is typically used as the tool tip text).
|
static String |
SMALL_ICON
A key to access the icon for the action.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers a listener to receive notification whenever one of the
action's properties is modified.
|
Object |
getValue(String key)
Returns the value associated with the specified key.
|
boolean |
isEnabled()
Returns the flag that indicates whether or not this action is enabled.
|
void |
putValue(String key,
Object value)
Sets the value associated with the specified key and sends a
PropertyChangeEvent to all registered listeners. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Deregisters a listener so that it no longer receives notification of
changes to the action's properties.
|
void |
setEnabled(boolean b)
Sets the flag that indicates whether or not this action is enabled.
|
actionPerformed
static final String DEFAULT
static final String LONG_DESCRIPTION
static final String NAME
static final String SHORT_DESCRIPTION
static final String SMALL_ICON
static final String ACCELERATOR_KEY
KeyStroke
used as the accelerator for the
action.static final String ACTION_COMMAND_KEY
static final String MNEMONIC_KEY
Object getValue(String key)
key
- the key (not null
).null
if the key is not found.void putValue(String key, Object value)
PropertyChangeEvent
to all registered listeners.
The standard keys are defined in this interface: NAME
,
SHORT_DESCRIPTION
, LONG_DESCRIPTION
,
SMALL_ICON
, ACTION_COMMAND_KEY
,
ACCELERATOR_KEY
and MNEMONIC_KEY
. Any existing value
associated with the key will be overwritten.key
- the key (not null
).value
- the value (null
permitted).boolean isEnabled()
void setEnabled(boolean b)
PropertyChangeEvent
is sent to
all registered listeners.b
- the new value of the flag.void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the listener.void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listener.