ActionListener
, EventListener
, Action
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.
This is based on sun.swing.UIAction in J2SE 1.5
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
Modifier and Type | Method | Description |
---|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
|
String |
getName() |
|
Object |
getValue(String 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) |
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
|
void |
setEnabled(boolean b) |
actionPerformed
public UIAction(String name)
public final String getName()
public void setEnabled(boolean b)
setEnabled
in interface Action
public 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)
addPropertyChangeListener
in interface Action
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Action
Copyright © 2018. All rights reserved.