java.lang.Object
org.dinopolis.util.gui.SelectedButtonActionSynchronizer
- All Implemented Interfaces:
- java.util.EventListener, java.awt.event.ItemListener, java.beans.PropertyChangeListener
- public class SelectedButtonActionSynchronizer
- extends java.lang.Object
- implements java.awt.event.ItemListener, java.beans.PropertyChangeListener
This class helps to synchronize actions and toggle buttons (like
CheckButtonMenuItems, RadioButtonMenuItems, ...). Whenever the
button's state changes, the selected state is set into the action
(key SELECTED, value Boolean object), or vice versa
(if the value SELECTED is set into the action, the button changes
its state accordingly).
- Version:
- $Revision: 1.6 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
weak_action_
java.lang.ref.WeakReference weak_action_
weak_button_
java.lang.ref.WeakReference weak_button_
SELECTED
public static final java.lang.String SELECTED
- See Also:
- Constant Field Values
SelectedButtonActionSynchronizer
public SelectedButtonActionSynchronizer(javax.swing.AbstractButton button,
javax.swing.Action action)
- Constructor using the AbstractButton and the Action to be synchronized.
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent event)
- ItemListener interface
- Specified by:
itemStateChanged in interface java.awt.event.ItemListener
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent event)
- ChangeListener interface
- Specified by:
propertyChange in interface java.beans.PropertyChangeListener
setAction
public void setAction(javax.swing.Action action)
- Sets the weak reference for the action.
getAction
public javax.swing.Action getAction()
- Resolves the weak reference for the action.
setButton
public void setButton(javax.swing.AbstractButton button)
- Sets the weak reference for the button.
getButton
public javax.swing.AbstractButton getButton()
- Resolves the weak reference for the button.