public class CWAction extends AbstractAction
The GNU General Public License for details.
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
LARGE_ICON
The icon to display when a large one is needed.
|
private EventListenerList |
listeners |
private static org.slf4j.Logger |
log
The log stream
|
private static long |
serialVersionUID
Serialization ID
|
static String |
TOOL_TIP
The tooltip to display.
|
changeSupport, enabled
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 |
---|
CWAction() |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent evt)
Forwards the ActionEvent to the registered listener.
|
void |
addActionListener(ActionListener listener)
Adds a listener for Action events.
|
CWAction |
clone()
Create a clone that does not copy the listeners.
|
CWAction |
enable(boolean newEnabled)
Set enabled either true or false on this action.
|
private KeyStroke |
getAccelerator(String acceleratorSpec)
Convert the string to a valid Accelerator (that is a KeyStroke)
|
private KeyStroke |
getKeyStroke(String acceleratorSpec) |
void |
removeActionListener(ActionListener listener)
Remove an ActionListener
|
CWAction |
setAccelerator(String acceleratorSpec)
Set the accelerator key from spec.
|
CWAction |
setLargeIcon(Icon icon)
Set or clear, using null, the icon on this action.
|
CWAction |
setLargeIcon(String iconPath) |
CWAction |
setListener(ActionListener listener)
Create a clone of this action and attache the listener.
|
CWAction |
setSmallIcon(Icon icon)
Set or clear, using null, the icon on this action.
|
CWAction |
setSmallIcon(String iconPath) |
CWAction |
setTooltip(String tooltip) |
String |
toString()
String representation of this object suitable for debugging
|
addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public static final String LARGE_ICON
public static final String TOOL_TIP
private EventListenerList listeners
private static final org.slf4j.Logger log
private static final long serialVersionUID
public CWAction setLargeIcon(Icon icon)
icon
- the small icon to setpublic CWAction setSmallIcon(Icon icon)
icon
- the small icon to setpublic CWAction setAccelerator(String acceleratorSpec)
acceleratorSpec
- public CWAction enable(boolean newEnabled)
newEnabled
- the desired statepublic CWAction setListener(ActionListener listener)
listener
- the listener for the actionpublic void actionPerformed(ActionEvent evt)
evt
- ActionEventpublic void addActionListener(ActionListener listener)
listener
- ActionListener
to addpublic void removeActionListener(ActionListener listener)
listener
- ActionListener
to removepublic String toString()
public CWAction clone()
clone
in class AbstractAction
AbstractAction.clone()
private KeyStroke getAccelerator(String acceleratorSpec)
private KeyStroke getKeyStroke(String acceleratorSpec) throws NumberFormatException
NumberFormatException