Action
interface. Standard behaviors like the get and set methods for
Action object properties (icon, text, and enabled) are defined
here. The developer need only subclass this abstract class and
define the actionPerformed method.Warning
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans package.
Please see java..
Action
| Modifier and Type | Field and Description |
|---|---|
| private transient ArrayTable | arrayTable
Contains the array of key bindings. |
| protected SwingPropertyChangeSupport | changeSupport
If any |
| protected boolean | enabled
Specifies whether action is enabled; the default is true. |
| private static Boolean | RECONFIGURE_ON_NULL
Whether or not actions should reconfigure all properties on null. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AbstractAction(String
the name ( name)Action.NAME) for the action; a
value of null is ignoredCreates an |
| public | AbstractAction(String
the name ( name, Icon Action.NAME) for the action; a
value of null is ignoredthe small icon ( icon)Action.SMALL_ICON) for the action; a
value of null is ignoredCreates an |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | addPropertyChangeListener(PropertyChangeListener
The listener)PropertyChangeListener to be addedImplements javax. Adds a |
| protected Object | |
| protected void | firePropertyChange(String
the name of the property that has changed propertyName, Object the old value of the property oldValue, Object the new value of the property newValue)Supports reporting bound property changes. |
| public Object[] | Returns: an array of key objects, ornull if no
keys have values setReturns an array of |
| public synchronized PropertyChangeListener[] | Returns: all of thePropertyChangeListeners added or an empty
array if no listeners have been addedReturns an array of all the |
| public Object | Returns: the bindingObject stored with this key; if there
are no keys, it will return nulla string containing the specified key)keyImplements javax. Gets the |
| pack-priv static boolean | |
| public boolean | Returns: true if the action is enabled, false otherwiseImplements javax. Returns true if the action is enabled. |
| pack-priv static boolean | |
| public void | putValue(String
the key, Object String that identifies the stored objectthe newValue)Object to store using this keyImplements javax. Sets the |
| private void | |
| public synchronized void | removePropertyChangeListener(PropertyChangeListener
the listener)PropertyChangeListener to be removedImplements javax. Removes a |
| public void | setEnabled(boolean
true to enable the action, false to
disable itImplements javax. Sets whether the |
| pack-priv static void | setEnabledFromAction(JComponent
the Component to set the enabled state on c, Action the Action to set the enabled state from, may be null a)Sets the enabled state of a component from an Action. |
| pack-priv static void | setToolTipTextFromAction(JComponent
the Component to set the tooltip text on c, Action the Action to set the tooltip text from, may be null a)Sets the tooltip text of a component from an Action. |
| pack-priv static boolean | shouldReconfigure(PropertyChangeEvent e)
Whether or not to reconfigure all action properties from the specified event. |
| private void |
| arrayTable | back to summary |
|---|---|
| private transient ArrayTable arrayTable Contains the array of key bindings. | |
| changeSupport | back to summary |
|---|---|
| protected SwingPropertyChangeSupport changeSupport If any | |
| enabled | back to summary |
|---|---|
| protected boolean enabled Specifies whether action is enabled; the default is true. | |
| RECONFIGURE_ON_NULL | back to summary |
|---|---|
| private static Boolean RECONFIGURE_ON_NULL Whether or not actions should reconfigure all properties on null. | |
| AbstractAction | back to summary |
|---|---|
| public AbstractAction() Creates an | |
| AbstractAction | back to summary |
|---|---|
| public AbstractAction(String name) Creates an
| |
| AbstractAction | back to summary |
|---|---|
| public AbstractAction(String name, Icon icon) Creates an | |
| addPropertyChangeListener | back to summary |
|---|---|
| public synchronized void addPropertyChangeListener(PropertyChangeListener listener) Implements javax. Adds a
A
| |
| clone | back to summary |
|---|---|
| protected Object clone() throws CloneNotSupportedException Overrides java. Clones the abstract action. This gives the clone
its own copy of the key/value list,
which is not handled for you by
| |
| firePropertyChange | back to summary |
|---|---|
| protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) Supports reporting bound property changes. This method can be called
when a bound property has changed and it will send the appropriate
| |
| getKeys | back to summary |
|---|---|
| public Object[] getKeys() Returns an array of
| |
| getPropertyChangeListeners | back to summary |
|---|---|
| public synchronized PropertyChangeListener[] getPropertyChangeListeners() Returns an array of all the
| |
| getValue | back to summary |
|---|---|
| public Object getValue(String key) Implements javax. Gets the
| |
| hasSelectedKey | back to summary |
|---|---|
| pack-priv static boolean hasSelectedKey(Action a) | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled() Implements javax. Returns true if the action is enabled.
| |
| isSelected | back to summary |
|---|---|
| pack-priv static boolean isSelected(Action a) | |
| putValue | back to summary |
|---|---|
| public void putValue(String key, Object newValue) Implements javax. Sets the
| |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException
| |
| removePropertyChangeListener | back to summary |
|---|---|
| public synchronized void removePropertyChangeListener(PropertyChangeListener listener) Implements javax. Removes a
| |
| setEnabled | back to summary |
|---|---|
| public void setEnabled(boolean newValue) Implements javax. Sets whether the
| |
| setEnabledFromAction | back to summary |
|---|---|
| pack-priv static void setEnabledFromAction(JComponent c, Action a) Sets the enabled state of a component from an Action.
| |
| setToolTipTextFromAction | back to summary |
|---|---|
| pack-priv static void setToolTipTextFromAction(JComponent c, Action a) Sets the tooltip text of a component from an Action.
| |
| shouldReconfigure | back to summary |
|---|---|
| pack-priv static boolean shouldReconfigure(PropertyChangeEvent e) Whether or not to reconfigure all action properties from the specified event. | |
| writeObject | back to summary |
|---|---|
private void writeObject(ObjectOutputStream s) throws IOException
| |