Class MenuAction
java.lang.Object
org.ka2ddo.yaac.gui.pluginadapter.MenuAction
- All Implemented Interfaces:
ActionListener
,ItemListener
,EventListener
,Action
,AbstractMenuActionPropertyListener
public class MenuAction
extends Object
implements Action, AbstractMenuActionPropertyListener, ItemListener
This class defines a Java Swing specific wrapper around the now GUI-independent
AbstractMenuAction class in the plugin API package.
- Author:
- Andrew Pavlin, KA2DDO
-
Field Summary
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
ConstructorDescriptionMenuAction
(AbstractMenuAction abstractMenuAction) Create the AWT/Swing-specific wrapper around an AbstractMenuAction. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked when an action occurs.void
Adds aPropertyChange
listener.Gets one of this object's properties using the associated key.boolean
Returns the enabled state of theAction
.void
DO NOT CALL.void
menuPropertyChanged
(String propertyName, Object oldValue, Object newValue) Tell the listener that a property has changed.void
Sets one of this object's properties using the associated key.void
Removes aPropertyChange
listener.void
setEnabled
(boolean b) Sets the enabled state of theAction
.
-
Constructor Details
-
MenuAction
Create the AWT/Swing-specific wrapper around an AbstractMenuAction.- Parameters:
abstractMenuAction
- AbstractMenuAction to instantiate in Java Swing
-
-
Method Details
-
addPropertyChangeListener
Adds aPropertyChange
listener. Containers and attached components use these methods to register interest in thisAction
object. When its enabled state or other property changes, the registered listeners are informed of the change.- Specified by:
addPropertyChangeListener
in interfaceAction
- Parameters:
listener
- aPropertyChangeListener
object
-
getValue
Gets one of this object's properties using the associated key. -
putValue
Sets one of this object's properties using the associated key. If the value has changed, aPropertyChangeEvent
is sent to listeners. -
setEnabled
public void setEnabled(boolean b) Sets the enabled state of theAction
. When enabled, any component associated with this object is active and able to fire this object'sactionPerformed
method. If the value has changed, aPropertyChangeEvent
is sent to listeners.- Specified by:
setEnabled
in interfaceAction
- Parameters:
b
- true to enable thisAction
, false to disable it
-
isEnabled
public boolean isEnabled()Returns the enabled state of theAction
. When enabled, any component associated with this object is active and able to fire this object'sactionPerformed
method. -
removePropertyChangeListener
Removes aPropertyChange
listener.- Specified by:
removePropertyChangeListener
in interfaceAction
- Parameters:
listener
- aPropertyChangeListener
object- See Also:
-
actionPerformed
Invoked when an action occurs.- Specified by:
actionPerformed
in interfaceActionListener
-
itemStateChanged
DO NOT CALL. Handles association of JMenuItemCheckBox with MenuAction.- Specified by:
itemStateChanged
in interfaceItemListener
- Parameters:
e
- ItemEvent reporting JMenuItemCheckBox state change
-