public class MenuAction extends java.lang.Object implements javax.swing.Action, AbstractMenuActionPropertyListener, java.awt.event.ItemListener
Constructor and Description |
---|
MenuAction(AbstractMenuAction abstractMenuAction)
Create the AWT/Swing-specific wrapper around an AbstractMenuAction.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action occurs.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a
PropertyChange listener. |
java.lang.Object |
getValue(java.lang.String key)
Gets one of this object's properties
using the associated key.
|
boolean |
isEnabled()
Returns the enabled state of the
Action . |
void |
itemStateChanged(java.awt.event.ItemEvent e)
DO NOT CALL.
|
void |
menuPropertyChanged(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Tell the listener that a property has changed.
|
void |
putValue(java.lang.String key,
java.lang.Object value)
Sets one of this object's properties
using the associated key.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a
PropertyChange listener. |
void |
setEnabled(boolean b)
Sets the enabled state of the
Action . |
public MenuAction(AbstractMenuAction abstractMenuAction)
abstractMenuAction
- AbstractMenuAction to instantiate in Java Swingpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChange
listener. Containers and attached
components use these methods to register interest in this
Action
object. When its enabled state or other property
changes, the registered listeners are informed of the change.addPropertyChangeListener
in interface javax.swing.Action
listener
- a PropertyChangeListener
objectpublic java.lang.Object getValue(java.lang.String key)
getValue
in interface javax.swing.Action
putValue(java.lang.String, java.lang.Object)
public void putValue(java.lang.String key, java.lang.Object value)
PropertyChangeEvent
is sent
to listeners.putValue
in interface javax.swing.Action
key
- a String
containing the keyvalue
- an Object
valuepublic void setEnabled(boolean b)
Action
. When enabled,
any component associated with this object is active and
able to fire this object's actionPerformed
method.
If the value has changed, a PropertyChangeEvent
is sent
to listeners.setEnabled
in interface javax.swing.Action
b
- true to enable this Action
, false to disable itpublic boolean isEnabled()
Action
. When enabled,
any component associated with this object is active and
able to fire this object's actionPerformed
method.isEnabled
in interface javax.swing.Action
Action
is enabledpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChange
listener.removePropertyChangeListener
in interface javax.swing.Action
listener
- a PropertyChangeListener
objectaddPropertyChangeListener(java.beans.PropertyChangeListener)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void menuPropertyChanged(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
menuPropertyChanged
in interface AbstractMenuActionPropertyListener
propertyName
- String name of propertyoldValue
- Object value before the changenewValue
- Object value after the changepublic void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener
e
- ItemEvent reporting JMenuItemCheckBox state change