public abstract class UIAction extends Object implements Action
actionPerformed.
A typical subclass will look like:
private static class Actions extends UIAction {
Actions(String name) {
super(name);
}
public void actionPerformed(ActionEvent ae) {
if (getName() == "selectAll") {
selectAll();
}
else if (getName() == "cancelEditing") {
cancelEditing();
}
}
}
Subclasses that wish to conditionalize the enabled state should override
isEnabled(Component), and be aware that the passed in
Component may be null.
com.sun.java.swing.ExtendedAction,
ActionACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a
PropertyChange listener. |
String |
getName() |
Object |
getValue(String key)
Gets one of this object's properties
using the associated key.
|
boolean |
isEnabled()
Cover method for
isEnabled(null). |
boolean |
isEnabled(Object sender)
Subclasses that need to conditionalize the enabled state should
override this.
|
void |
putValue(String key,
Object value)
Sets one of this object's properties
using the associated key.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a
PropertyChange listener. |
void |
setEnabled(boolean b)
Sets the enabled state of the
Action. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitactionPerformedpublic Object getValue(String key)
ActiongetValue in interface ActionAction.putValue(java.lang.String, java.lang.Object)public void putValue(String key, Object value)
ActionPropertyChangeEvent is sent
to listeners.public void setEnabled(boolean b)
ActionAction. When enabled,
any component associated with this object is active and
able to fire this object's actionPerformed method.
If the value has changed, a PropertyChangeEvent is sent
to listeners.setEnabled in interface Actionb - true to enable this Action, false to disable itpublic final boolean isEnabled()
isEnabled(null).public boolean isEnabled(Object sender)
sender may be null.sender - Widget enabled state is being asked for, may be null.public void addPropertyChangeListener(PropertyChangeListener listener)
ActionPropertyChange listener. Containers and attached
components use these methods to register interest in this
Action object. When its enabled state or other property
changes, the registered listeners are informed of the change.addPropertyChangeListener in interface Actionlistener - a PropertyChangeListener objectpublic void removePropertyChangeListener(PropertyChangeListener listener)
ActionPropertyChange listener.removePropertyChangeListener in interface Actionlistener - a PropertyChangeListener objectAction.addPropertyChangeListener(java.beans.PropertyChangeListener)