javax.swing
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Modifier and Type | Field and Description |
|---|---|
protected SwingPropertyChangeSupport |
changeSupport
If any PropertyChangeListeners have been registered, the
changeSupport field describes them. |
protected boolean |
enabled
Specifies whether action is enabled; the default is true. |
| Fields inherited from interface javax.swing.Action |
|---|
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 |
|---|
AbstractAction()
Creates an Action. |
AbstractAction(String name)
Creates an Action with the specified name. |
AbstractAction(String name,
Icon icon)
Creates an Action with the specified name and small icon. |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
protected Object |
clone()
Clones the abstract action. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Supports reporting bound property changes. |
Object[] |
getKeys()
Returns an array of Objects which are keys for
which values have been set for this AbstractAction,
or null if no keys have values set. |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the PropertyChangeListeners added
to this AbstractAction with addPropertyChangeListener(). |
Object |
getValue(String key)
Gets the Object associated with the specified key. |
boolean |
isEnabled()
Returns true if the action is enabled. |
void |
putValue(String key,
Object newValue)
Sets the Value associated with the specified key. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
setEnabled(boolean newValue)
Sets whether the Action is enabled. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.awt.event.ActionListener |
|---|
actionPerformed |
| Field Detail |
|---|
enabled
protected boolean enabled
- Specifies whether action is enabled; the default is true.
changeSupport
protected SwingPropertyChangeSupport changeSupport
- If any
PropertyChangeListenershave been registered, thechangeSupportfield describes them.
| Constructor Detail |
|---|
AbstractAction
public AbstractAction()
- Creates an
Action.
AbstractAction
public AbstractAction(String name)
- Creates an
Actionwith the specified name. - Parameters:
name- the name (Action.NAME) for the action; a value ofnullis ignored
AbstractAction
public AbstractAction(String name, Icon icon)
- Creates an
Actionwith the specified name and small icon. - Parameters:
name- the name (Action.NAME) for the action; a value ofnullis ignoredicon- the small icon (Action.SMALL_ICON) for the action; a value ofnullis ignored
| Method Detail |
|---|
getValue
public Object getValue(String key)
- Gets the
Objectassociated with the specified key. - Parameters:
key- a string containing the specifiedkey- Returns:
- the binding
Objectstored with this key; if there are no keys, it will returnnull - See Also:
Action.getValue(java.lang.String)
putValue
public void putValue(String key, Object newValue)
- Sets the
Valueassociated with the specified key. - Parameters:
key- theStringthat identifies the stored objectnewValue- theObjectto store using this key- See Also:
Action.putValue(java.lang.String, java.lang.Object)
isEnabled
public boolean isEnabled()
- Returns true if the action is enabled.
- Returns:
- true if the action is enabled, false otherwise
- See Also:
Action.isEnabled()
setEnabled
public void setEnabled(boolean newValue)
- Sets whether the
Actionis enabled. The default istrue. - Specified by:
setEnabledin interfaceAction
- Parameters:
newValue-trueto enable the action,falseto disable it- See Also:
Action.setEnabled(boolean)
getKeys
public Object[] getKeys()
- Returns an array of
Objects which are keys for which values have been set for thisAbstractAction, ornullif no keys have values set. - Returns:
- an array of key objects, or
nullif no keys have values set - Since:
- 1.3
firePropertyChange
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
PropertyChangeEventto any registeredPropertyChangeListeners.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a
PropertyChangeListenerto the listener list. The listener is registered for all properties.A
PropertyChangeEventwill get fired in response to setting a bound property, e.g.setFont,setBackground, orsetForeground. Note that if the current component is inheriting its foreground, background, or font from its container, then no event will be fired in response to a change in the inherited property. - Specified by:
addPropertyChangeListenerin interfaceAction
- Parameters:
listener- ThePropertyChangeListenerto be added- See Also:
Action.addPropertyChangeListener(java.beans.PropertyChangeListener)
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a
PropertyChangeListenerfrom the listener list. This removes aPropertyChangeListenerthat was registered for all properties. - Specified by:
removePropertyChangeListenerin interfaceAction
- Parameters:
listener- thePropertyChangeListenerto be removed- See Also:
Action.removePropertyChangeListener(java.beans.PropertyChangeListener)
getPropertyChangeListeners
public PropertyChangeListener[] getPropertyChangeListeners()
- Returns an array of all the
PropertyChangeListeners added to this AbstractAction with addPropertyChangeListener(). - Returns:
- all of the
PropertyChangeListeners added or an empty array if no listeners have been added - Since:
- 1.4
clone
protected Object clone() throws CloneNotSupportedException
- Clones the abstract action. This gives the clone
its own copy of the key/value list,
which is not handled for you by
Object.clone(). - Returns:
- a clone of this instance.
- Throws:
CloneNotSupportedException- if the object's class does not support theCloneableinterface. Subclasses that override theclonemethod can also throw this exception to indicate that an instance cannot be cloned.- See Also:
Cloneable
|
Java™ Platform Standard Ed. 7 DRAFT ea-b59 |
|||||||||
| PREV CLASS NEXT CLASS | NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
javax.swing.AbstractAction