public abstract class AbstractActionExt extends AbstractAction implements ItemListener
SwingX 1.6.3 updates AbstractActionExt to use new features of Action that were
added in Java 1.6. The selection is now managed with Action.SELECTED_KEY, which
allows the action to correctly configured Swing buttons. The LARGE_ICON has also been
changed to correspond to Action.LARGE_ICON_KEY.
| Modifier and Type | Field and Description |
|---|---|
static String |
GROUP
The key for the button group
|
static String |
IS_STATE
The key for the flag which indicates that this is a state type.
|
static String |
LARGE_ICON
The key for the large icon
|
changeSupport, enabledACCELERATOR_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 |
|---|
AbstractActionExt()
Default constructor, does nothing.
|
AbstractActionExt(AbstractActionExt action)
Copy constructor copies the state.
|
AbstractActionExt(String name) |
AbstractActionExt(String name,
Icon icon) |
AbstractActionExt(String name,
String command)
Constructs an Action with the label and command
|
AbstractActionExt(String name,
String command,
Icon icon) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Will perform cleanup on the object.
|
KeyStroke |
getAccelerator()
Returns the key stroke which represents an accelerator
for the action.
|
String |
getActionCommand()
Returns the action command.
|
Object |
getGroup() |
Icon |
getLargeIcon()
Returns a large icon which represents the action.
|
String |
getLongDescription()
Returns a long description of the action.
|
int |
getMnemonic()
Return the mnemonic key code for the action.
|
String |
getName()
Returns the name of the action.
|
String |
getShortDescription()
Returns a short description of the action.
|
Icon |
getSmallIcon()
Returns a small icon which represents the action.
|
boolean |
isSelected() |
boolean |
isStateAction()
Indicates if this action has states.
|
void |
itemStateChanged(ItemEvent e)
Callback method as
ItemListener. |
void |
setAccelerator(KeyStroke key)
Sets the key stroke which represents an accelerator
for the action.
|
void |
setActionCommand(String key)
Sets the action command key.
|
void |
setGroup(Object group)
Sets the group identity of the state action.
|
void |
setLargeIcon(Icon icon)
Sets the large icon which represents the action.
|
void |
setLongDescription(String desc)
Sets the long description of the action.
|
void |
setMnemonic(int mnemonic)
Sets the mnemonic key code for the action.
|
void |
setMnemonic(String mnemonic) |
void |
setName(String name)
Sets the name of the action.
|
void |
setSelected(boolean newValue)
Changes the state of the action.
|
void |
setShortDescription(String desc)
Sets the short description of the action.
|
void |
setSmallIcon(Icon icon)
Sets the small icon which represents the action.
|
void |
setStateAction()
Set the state property to true.
|
void |
setStateAction(boolean state)
Set the state property.
|
String |
toString() |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitactionPerformedpublic static final String LARGE_ICON
As of SwingX 1.6.3 is now has the same value as Action.LARGE_ICON_KEY, which is new to 1.6.
public static final String GROUP
public static final String IS_STATE
public AbstractActionExt()
public AbstractActionExt(AbstractActionExt action)
public AbstractActionExt(String name)
public AbstractActionExt(String name, String command)
name - name of the action usually used as a labelcommand - command key of the actionpublic String getShortDescription()
public void setShortDescription(String desc)
This is a convenience method for putValue with the
Action.SHORT_DESCRIPTION key.
desc - the short description; can be nullwAction.SHORT_DESCRIPTION,
Action.putValue(java.lang.String, java.lang.Object)public String getLongDescription()
public void setLongDescription(String desc)
This is a convenience method for putValue with the
Action.LONG_DESCRIPTION key.
desc - the long description; can be nullAction.LONG_DESCRIPTION,
Action.putValue(java.lang.String, java.lang.Object)public Icon getSmallIcon()
public void setSmallIcon(Icon icon)
This is a convenience method for putValue with the
Action.SMALL_ICON key.
icon - the small icon; can be nullAction.SMALL_ICON,
Action.putValue(java.lang.String, java.lang.Object)public Icon getLargeIcon()
public void setLargeIcon(Icon icon)
This is a convenience method for putValue with the
LARGE_ICON key.
icon - the large icon; can be nullLARGE_ICON,
Action.putValue(java.lang.String, java.lang.Object)public void setName(String name)
This is a convenience method for putValue with the
Action.NAME key.
name - the name of the action; can be nullAction.NAME,
Action.putValue(java.lang.String, java.lang.Object)public String getName()
public void setMnemonic(String mnemonic)
public void setMnemonic(int mnemonic)
This is a convenience method for putValue with the
Action.MNEMONIC_KEY key.
This method does not validate the value. Please see
AbstractButton.setMnemonic(int) for details
concerning the value of the mnemonic.
mnemonic - an int key code mnemonic or 0AbstractButton.setMnemonic(int),
Action.MNEMONIC_KEY,
Action.putValue(java.lang.String, java.lang.Object)public int getMnemonic()
public void setActionCommand(String key)
This is a convenience method for putValue with the
Action.ACTION_COMMAND_KEY key.
key - the action commandAction.ACTION_COMMAND_KEY,
Action.putValue(java.lang.String, java.lang.Object)public String getActionCommand()
public KeyStroke getAccelerator()
public void setAccelerator(KeyStroke key)
This is a convenience method for putValue with the
Action.ACCELERATOR_KEY key.
key - the key stroke; can be nullAction.ACCELERATOR_KEY,
Action.putValue(java.lang.String, java.lang.Object)public void setGroup(Object group)
public Object getGroup()
public void dispose()
public boolean isStateAction()
public void setStateAction()
public void setStateAction(boolean state)
state - if true then this action will fire ItemEventspublic boolean isSelected()
public void setSelected(boolean newValue)
newValue - true to set the action as selected of the action.Action.SELECTED_KEYpublic void itemStateChanged(ItemEvent e)
ItemListener. Updates internal state based
on the given ItemEvent. Here: synchs selected property if isStateAction(), does nothing otherwise.
itemStateChanged in interface ItemListenere - the ItemEvent fired by a ItemSelectable on changing the selected
state.Copyright © 2017. All Rights Reserved.