|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractAction com.cosylab.gui.components.util.ToggleAction
public class ToggleAction
An extension of the javax.swing.Action
interface which provides
selected
bound property. It can be used to specify an action
which switches between two different states. GUI components will render
these actions with check boxes or toggle buttons.
To use this action, either instantiate this class and register as a propertyChangeListener, responding to events that denote a change in "selected" property, or extend this class, overriding actionPerformed() method.
Field Summary | |
---|---|
static java.lang.String |
LARGE_SELECTED_ICON
Large icon used when the action is selected |
static java.lang.String |
SMALL_SELECTED_ICON
Icon used when the action is selected |
Fields inherited from class javax.swing.AbstractAction |
---|
changeSupport, enabled |
Fields inherited from interface javax.swing.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 |
Constructor Summary | |
---|---|
ToggleAction()
Constructor with default values. |
|
ToggleAction(java.lang.String name)
Constructor with name. |
|
ToggleAction(java.lang.String name,
boolean selected)
Constructor with name and selection flag. |
|
ToggleAction(java.lang.String name,
javax.swing.Icon icon)
Contructor with name and icon. |
|
ToggleAction(java.lang.String name,
javax.swing.Icon icon,
boolean selected)
Contructor with name, icon and selection flag. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Overriden to modify selection status. |
boolean |
isSelected()
|
protected void |
selectionChanged(boolean selected)
Override this method to provide custom event handling when selection changes. |
void |
setSelected(boolean selected)
Sets the selected property. |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SMALL_SELECTED_ICON
public static final java.lang.String LARGE_SELECTED_ICON
Constructor Detail |
---|
public ToggleAction()
public ToggleAction(java.lang.String name)
name
- the name of the actionpublic ToggleAction(java.lang.String name, boolean selected)
name
- the name of the actionselected
- the selection flagpublic ToggleAction(java.lang.String name, javax.swing.Icon icon)
name
- icon
- public ToggleAction(java.lang.String name, javax.swing.Icon icon, boolean selected)
name
- the name of actionicon
- the icon to be used GUI elementselected
- the selection flagMethod Detail |
---|
public void setSelected(boolean selected)
selected
property. Fires propertyChange events and
calls actionPerformed() method with this
as event source.
selected
- public boolean isSelected()
public void actionPerformed(java.awt.event.ActionEvent e)
protected void selectionChanged(boolean selected)
newSelected
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |