javax.swing
Class AbstractAction

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.AbstractAction
All Implemented Interfaces:
ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , EventListener sample code for java.util.EventListener definition code for java.util.EventListener , Action sample code for javax.swing.Action definition code for javax.swing.Action
Direct Known Subclasses:
BasicDesktopPaneUI.CloseAction sample code for javax.swing.plaf.basic.BasicDesktopPaneUI.CloseAction definition code for javax.swing.plaf.basic.BasicDesktopPaneUI.CloseAction , BasicDesktopPaneUI.MaximizeAction sample code for javax.swing.plaf.basic.BasicDesktopPaneUI.MaximizeAction definition code for javax.swing.plaf.basic.BasicDesktopPaneUI.MaximizeAction , BasicDesktopPaneUI.MinimizeAction sample code for javax.swing.plaf.basic.BasicDesktopPaneUI.MinimizeAction definition code for javax.swing.plaf.basic.BasicDesktopPaneUI.MinimizeAction , BasicDesktopPaneUI.NavigateAction sample code for javax.swing.plaf.basic.BasicDesktopPaneUI.NavigateAction definition code for javax.swing.plaf.basic.BasicDesktopPaneUI.NavigateAction , BasicDesktopPaneUI.OpenAction sample code for javax.swing.plaf.basic.BasicDesktopPaneUI.OpenAction definition code for javax.swing.plaf.basic.BasicDesktopPaneUI.OpenAction , BasicFileChooserUI.ApproveSelectionAction sample code for javax.swing.plaf.basic.BasicFileChooserUI.ApproveSelectionAction definition code for javax.swing.plaf.basic.BasicFileChooserUI.ApproveSelectionAction , BasicFileChooserUI.CancelSelectionAction sample code for javax.swing.plaf.basic.BasicFileChooserUI.CancelSelectionAction definition code for javax.swing.plaf.basic.BasicFileChooserUI.CancelSelectionAction , BasicFileChooserUI.ChangeToParentDirectoryAction sample code for javax.swing.plaf.basic.BasicFileChooserUI.ChangeToParentDirectoryAction definition code for javax.swing.plaf.basic.BasicFileChooserUI.ChangeToParentDirectoryAction , BasicFileChooserUI.GoHomeAction sample code for javax.swing.plaf.basic.BasicFileChooserUI.GoHomeAction definition code for javax.swing.plaf.basic.BasicFileChooserUI.GoHomeAction , BasicFileChooserUI.NewFolderAction sample code for javax.swing.plaf.basic.BasicFileChooserUI.NewFolderAction definition code for javax.swing.plaf.basic.BasicFileChooserUI.NewFolderAction , BasicFileChooserUI.UpdateAction sample code for javax.swing.plaf.basic.BasicFileChooserUI.UpdateAction definition code for javax.swing.plaf.basic.BasicFileChooserUI.UpdateAction , BasicInternalFrameTitlePane.CloseAction sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.CloseAction definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.CloseAction , BasicInternalFrameTitlePane.IconifyAction sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.IconifyAction definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.IconifyAction , BasicInternalFrameTitlePane.MaximizeAction sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction , BasicInternalFrameTitlePane.MoveAction sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.MoveAction definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.MoveAction , BasicInternalFrameTitlePane.RestoreAction sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.RestoreAction definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.RestoreAction , BasicInternalFrameTitlePane.SizeAction sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.SizeAction definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.SizeAction , BasicSliderUI.ActionScroller sample code for javax.swing.plaf.basic.BasicSliderUI.ActionScroller definition code for javax.swing.plaf.basic.BasicSliderUI.ActionScroller , BasicTreeUI.TreeCancelEditingAction sample code for javax.swing.plaf.basic.BasicTreeUI.TreeCancelEditingAction definition code for javax.swing.plaf.basic.BasicTreeUI.TreeCancelEditingAction , BasicTreeUI.TreeHomeAction sample code for javax.swing.plaf.basic.BasicTreeUI.TreeHomeAction definition code for javax.swing.plaf.basic.BasicTreeUI.TreeHomeAction , BasicTreeUI.TreeIncrementAction sample code for javax.swing.plaf.basic.BasicTreeUI.TreeIncrementAction definition code for javax.swing.plaf.basic.BasicTreeUI.TreeIncrementAction , BasicTreeUI.TreePageAction sample code for javax.swing.plaf.basic.BasicTreeUI.TreePageAction definition code for javax.swing.plaf.basic.BasicTreeUI.TreePageAction , BasicTreeUI.TreeToggleAction sample code for javax.swing.plaf.basic.BasicTreeUI.TreeToggleAction definition code for javax.swing.plaf.basic.BasicTreeUI.TreeToggleAction , BasicTreeUI.TreeTraverseAction sample code for javax.swing.plaf.basic.BasicTreeUI.TreeTraverseAction definition code for javax.swing.plaf.basic.BasicTreeUI.TreeTraverseAction , MetalFileChooserUI.DirectoryComboBoxAction sample code for javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxAction definition code for javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxAction , TextAction sample code for javax.swing.text.TextAction definition code for javax.swing.text.TextAction

public abstract class AbstractAction
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Action sample code for javax.swing.Action definition code for javax.swing.Action , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

This class provides default implementations for the JFC Action interface. Standard behaviors like the get and set methods for Action object properties (icon, text, and enabled) are defined here. The developer need only subclass this abstract class and define the actionPerformed method.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Action sample code for javax.swing.Action definition code for javax.swing.Action , Serialized Form

Field Summary
protected  SwingPropertyChangeSupport sample code for javax.swing.event.SwingPropertyChangeSupport definition code for javax.swing.event.SwingPropertyChangeSupport changeSupport sample code for javax.swing.AbstractAction.changeSupport definition code for javax.swing.AbstractAction.changeSupport
          If any PropertyChangeListeners have been registered, the changeSupport field describes them.
protected  boolean enabled sample code for javax.swing.AbstractAction.enabled definition code for javax.swing.AbstractAction.enabled
          Specifies whether action is enabled; the default is true.
 
Fields inherited from interface javax.swing.Action sample code for javax.swing.Action definition code for javax.swing.Action
ACCELERATOR_KEY sample code for javax.swing.Action.ACCELERATOR_KEY definition code for javax.swing.Action.ACCELERATOR_KEY , ACTION_COMMAND_KEY sample code for javax.swing.Action.ACTION_COMMAND_KEY definition code for javax.swing.Action.ACTION_COMMAND_KEY , DEFAULT sample code for javax.swing.Action.DEFAULT definition code for javax.swing.Action.DEFAULT , LONG_DESCRIPTION sample code for javax.swing.Action.LONG_DESCRIPTION definition code for javax.swing.Action.LONG_DESCRIPTION , MNEMONIC_KEY sample code for javax.swing.Action.MNEMONIC_KEY definition code for javax.swing.Action.MNEMONIC_KEY , NAME sample code for javax.swing.Action.NAME definition code for javax.swing.Action.NAME , SHORT_DESCRIPTION sample code for javax.swing.Action.SHORT_DESCRIPTION definition code for javax.swing.Action.SHORT_DESCRIPTION , SMALL_ICON sample code for javax.swing.Action.SMALL_ICON definition code for javax.swing.Action.SMALL_ICON
 
Constructor Summary
AbstractAction sample code for javax.swing.AbstractAction.AbstractAction() definition code for javax.swing.AbstractAction.AbstractAction() ()
          Defines an Action object with a default description string and default icon.
AbstractAction sample code for javax.swing.AbstractAction.AbstractAction(java.lang.String) definition code for javax.swing.AbstractAction.AbstractAction(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Defines an Action object with the specified description string and a default icon.
AbstractAction sample code for javax.swing.AbstractAction.AbstractAction(java.lang.String, javax.swing.Icon) definition code for javax.swing.AbstractAction.AbstractAction(java.lang.String, javax.swing.Icon) (String sample code for java.lang.String definition code for java.lang.String  name, Icon sample code for javax.swing.Icon definition code for javax.swing.Icon  icon)
          Defines an Action object with the specified description string and a the specified icon.
 
Method Summary
 void addPropertyChangeListener sample code for javax.swing.AbstractAction.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.AbstractAction.addPropertyChangeListener(java.beans.PropertyChangeListener) (PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener  listener)
          Adds a PropertyChangeListener to the listener list.
protected  Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for javax.swing.AbstractAction.clone() definition code for javax.swing.AbstractAction.clone() ()
          Clones the abstract action.
protected  void firePropertyChange sample code for javax.swing.AbstractAction.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) definition code for javax.swing.AbstractAction.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) (String sample code for java.lang.String definition code for java.lang.String  propertyName, Object sample code for java.lang.Object definition code for java.lang.Object  oldValue, Object sample code for java.lang.Object definition code for java.lang.Object  newValue)
          Supports reporting bound property changes.
 Object sample code for java.lang.Object definition code for java.lang.Object [] getKeys sample code for javax.swing.AbstractAction.getKeys() definition code for javax.swing.AbstractAction.getKeys() ()
          Returns an array of Objects which are keys for which values have been set for this AbstractAction, or null if no keys have values set.
 PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener [] getPropertyChangeListeners sample code for javax.swing.AbstractAction.getPropertyChangeListeners() definition code for javax.swing.AbstractAction.getPropertyChangeListeners() ()
          Returns an array of all the PropertyChangeListeners added to this AbstractAction with addPropertyChangeListener().
 Object sample code for java.lang.Object definition code for java.lang.Object getValue sample code for javax.swing.AbstractAction.getValue(java.lang.String) definition code for javax.swing.AbstractAction.getValue(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  key)
          Gets the Object associated with the specified key.
 boolean isEnabled sample code for javax.swing.AbstractAction.isEnabled() definition code for javax.swing.AbstractAction.isEnabled() ()
          Returns true if the action is enabled.
 void putValue sample code for javax.swing.AbstractAction.putValue(java.lang.String, java.lang.Object) definition code for javax.swing.AbstractAction.putValue(java.lang.String, java.lang.Object) (String sample code for java.lang.String definition code for java.lang.String  key, Object sample code for java.lang.Object definition code for java.lang.Object  newValue)
          Sets the Value associated with the specified key.
 void removePropertyChangeListener sample code for javax.swing.AbstractAction.removePropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.AbstractAction.removePropertyChangeListener(java.beans.PropertyChangeListener) (PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener  listener)
          Removes a PropertyChangeListener from the listener list.
 void setEnabled sample code for javax.swing.AbstractAction.setEnabled(boolean) definition code for javax.swing.AbstractAction.setEnabled(boolean) (boolean newValue)
          Enables or disables the action.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface java.awt.event.ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener
actionPerformed sample code for java.awt.event.ActionListener.actionPerformed(java.awt.event.ActionEvent) definition code for java.awt.event.ActionListener.actionPerformed(java.awt.event.ActionEvent)
 

Field Detail

enabled sample code for javax.swing.AbstractAction.enabled

protected boolean enabled
Specifies whether action is enabled; the default is true.


changeSupport sample code for javax.swing.AbstractAction.changeSupport

protected SwingPropertyChangeSupport sample code for javax.swing.event.SwingPropertyChangeSupport definition code for javax.swing.event.SwingPropertyChangeSupport  changeSupport
If any PropertyChangeListeners have been registered, the changeSupport field describes them.

Constructor Detail

AbstractAction sample code for javax.swing.AbstractAction() definition code for javax.swing.AbstractAction()

public AbstractAction()
Defines an Action object with a default description string and default icon.


AbstractAction sample code for javax.swing.AbstractAction(java.lang.String) definition code for javax.swing.AbstractAction(java.lang.String)

public AbstractAction(String sample code for java.lang.String definition code for java.lang.String  name)
Defines an Action object with the specified description string and a default icon.


AbstractAction sample code for javax.swing.AbstractAction(java.lang.String, javax.swing.Icon) definition code for javax.swing.AbstractAction(java.lang.String, javax.swing.Icon)

public AbstractAction(String sample code for java.lang.String definition code for java.lang.String  name,
                      Icon sample code for javax.swing.Icon definition code for javax.swing.Icon  icon)
Defines an Action object with the specified description string and a the specified icon.

Method Detail

getValue sample code for javax.swing.AbstractAction.getValue(java.lang.String) definition code for javax.swing.AbstractAction.getValue(java.lang.String)

public Object sample code for java.lang.Object definition code for java.lang.Object  getValue(String sample code for java.lang.String definition code for java.lang.String  key)
Gets the Object associated with the specified key.

Specified by:
getValue sample code for javax.swing.Action.getValue(java.lang.String) definition code for javax.swing.Action.getValue(java.lang.String) in interface Action sample code for javax.swing.Action definition code for javax.swing.Action
Parameters:
key - a string containing the specified key
Returns:
the binding Object stored with this key; if there are no keys, it will return null
See Also:
Action.getValue(java.lang.String) sample code for javax.swing.Action.getValue(java.lang.String) definition code for javax.swing.Action.getValue(java.lang.String)

putValue sample code for javax.swing.AbstractAction.putValue(java.lang.String, java.lang.Object) definition code for javax.swing.AbstractAction.putValue(java.lang.String, java.lang.Object)

public void putValue(String sample code for java.lang.String definition code for java.lang.String  key,
                     Object sample code for java.lang.Object definition code for java.lang.Object  newValue)
Sets the Value associated with the specified key.

Specified by:
putValue sample code for javax.swing.Action.putValue(java.lang.String, java.lang.Object) definition code for javax.swing.Action.putValue(java.lang.String, java.lang.Object) in interface Action sample code for javax.swing.Action definition code for javax.swing.Action
Parameters:
key - the String that identifies the stored object
newValue - the Object to store using this key
See Also:
Action.putValue(java.lang.String, java.lang.Object) sample code for javax.swing.Action.putValue(java.lang.String, java.lang.Object) definition code for javax.swing.Action.putValue(java.lang.String, java.lang.Object)

isEnabled sample code for javax.swing.AbstractAction.isEnabled() definition code for javax.swing.AbstractAction.isEnabled()

public boolean isEnabled()
Returns true if the action is enabled.

Specified by:
isEnabled sample code for javax.swing.Action.isEnabled() definition code for javax.swing.Action.isEnabled() in interface Action sample code for javax.swing.Action definition code for javax.swing.Action
Returns:
true if the action is enabled, false otherwise
See Also:
Action.isEnabled() sample code for javax.swing.Action.isEnabled() definition code for javax.swing.Action.isEnabled()

setEnabled sample code for javax.swing.AbstractAction.setEnabled(boolean) definition code for javax.swing.AbstractAction.setEnabled(boolean)

public void setEnabled(boolean newValue)
Enables or disables the action.

Specified by:
setEnabled sample code for javax.swing.Action.setEnabled(boolean) definition code for javax.swing.Action.setEnabled(boolean) in interface Action sample code for javax.swing.Action definition code for javax.swing.Action
Parameters:
newValue - true to enable the action, false to disable it
See Also:
Action.setEnabled(boolean) sample code for javax.swing.Action.setEnabled(boolean) definition code for javax.swing.Action.setEnabled(boolean)

getKeys sample code for javax.swing.AbstractAction.getKeys() definition code for javax.swing.AbstractAction.getKeys()

public Object sample code for java.lang.Object definition code for java.lang.Object [] getKeys()
Returns an array of Objects which are keys for which values have been set for this AbstractAction, or null if no keys have values set.

Returns:
an array of key objects, or null if no keys have values set
Since:
1.3

firePropertyChange sample code for javax.swing.AbstractAction.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) definition code for javax.swing.AbstractAction.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)

protected void firePropertyChange(String sample code for java.lang.String definition code for java.lang.String  propertyName,
                                  Object sample code for java.lang.Object definition code for java.lang.Object  oldValue,
                                  Object sample code for java.lang.Object definition code for java.lang.Object  newValue)
Supports reporting bound property changes. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.


addPropertyChangeListener sample code for javax.swing.AbstractAction.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.AbstractAction.addPropertyChangeListener(java.beans.PropertyChangeListener)

public void addPropertyChangeListener(PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener  listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to setting a bound property, e.g. setFont, setBackground, or setForeground. Note that if the current component is inheriting its foreground, background, or font from its container, then no event will be fired in response to a change in the inherited property.

Specified by:
addPropertyChangeListener sample code for javax.swing.Action.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.Action.addPropertyChangeListener(java.beans.PropertyChangeListener) in interface Action sample code for javax.swing.Action definition code for javax.swing.Action
Parameters:
listener - The PropertyChangeListener to be added
See Also:
Action.addPropertyChangeListener(java.beans.PropertyChangeListener) sample code for javax.swing.Action.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.Action.addPropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener sample code for javax.swing.AbstractAction.removePropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.AbstractAction.removePropertyChangeListener(java.beans.PropertyChangeListener)

public void removePropertyChangeListener(PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener  listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Specified by:
removePropertyChangeListener sample code for javax.swing.Action.removePropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.Action.removePropertyChangeListener(java.beans.PropertyChangeListener) in interface Action sample code for javax.swing.Action definition code for javax.swing.Action
Parameters:
listener - the PropertyChangeListener to be removed
See Also:
Action.removePropertyChangeListener(java.beans.PropertyChangeListener) sample code for javax.swing.Action.removePropertyChangeListener(java.beans.PropertyChangeListener) definition code for javax.swing.Action.removePropertyChangeListener(java.beans.PropertyChangeListener)

getPropertyChangeListeners sample code for javax.swing.AbstractAction.getPropertyChangeListeners() definition code for javax.swing.AbstractAction.getPropertyChangeListeners()

public PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener [] getPropertyChangeListeners()
Returns an array of all the PropertyChangeListeners added to this AbstractAction with addPropertyChangeListener().

Returns:
all of the PropertyChangeListeners added or an empty array if no listeners have been added
Since:
1.4

clone sample code for javax.swing.AbstractAction.clone() definition code for javax.swing.AbstractAction.clone()

protected Object sample code for java.lang.Object definition code for java.lang.Object  clone()
                throws CloneNotSupportedException sample code for java.lang.CloneNotSupportedException definition code for java.lang.CloneNotSupportedException 
Clones the abstract action. This gives the clone its own copy of the key/value list, which is not handled for you by Object.clone().

Overrides:
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a clone of this instance.
Throws:
CloneNotSupportedException sample code for java.lang.CloneNotSupportedException definition code for java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable