|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.UIAction
public abstract class UIAction
UIAction is the basis of all of basic's action classes that are used in
an ActionMap. Subclasses need to override 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.
This is based on sun.swing.UIAction in J2SE 1.5
Action
Field Summary |
---|
Fields inherited from interface javax.swing.Action |
---|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary | |
---|---|
UIAction(String name)
|
Method Summary | |
---|---|
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 . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.event.ActionListener |
---|
actionPerformed |
Constructor Detail |
---|
public UIAction(String name)
Method Detail |
---|
public final String getName()
public Object getValue(String key)
javax.swing.Action
getValue
in interface Action
Action.putValue(java.lang.String, java.lang.Object)
public void putValue(String key, Object value)
javax.swing.Action
PropertyChangeEvent
is sent
to listeners.
putValue
in interface Action
key
- a String
containing the keyvalue
- an Object
valuepublic void setEnabled(boolean b)
javax.swing.Action
Action
. 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 Action
b
- true to enable this Action
, false to disable itpublic final boolean isEnabled()
isEnabled(null)
.
isEnabled
in interface Action
Action
is enabledpublic boolean isEnabled(Object sender)
sender
may be null.
sender
- Widget enabled state is being asked for, may be null.public void addPropertyChangeListener(PropertyChangeListener listener)
javax.swing.Action
PropertyChange
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 Action
listener
- a PropertyChangeListener
objectpublic void removePropertyChangeListener(PropertyChangeListener listener)
javax.swing.Action
PropertyChange
listener.
removePropertyChangeListener
in interface Action
listener
- a PropertyChangeListener
objectAction.addPropertyChangeListener(java.beans.PropertyChangeListener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |