net.sf.swinglib.actions
Class DialogCloseAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by net.sf.swinglib.actions.DialogCloseAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public class DialogCloseAction
extends AbstractAction

When invoked, this action hides or disposes the associated dialog.

It's primarily used for implementations where the dialog is managed by a controller class that wraps that dialog's fields. Such dialogs do not need to take specific actions in response to the "OK" or "Cancel" button, because the controller handles that.

When to dispose versus hide: dispose dialogs that are infrequently used; this will free system resources. However, when you dispose a dialog you need to pack() it before displaying it again.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
DialogCloseAction(JDialog dialog, String name)
          Constructs an action that will hide the dialog.
DialogCloseAction(JDialog dialog, String name, boolean dispose)
          Constructs an action that will either hide or dispose the dialog.
 
Method Summary
 void actionPerformed(ActionEvent ignored)
           
 void setDialog(JDialog dialog)
          Sets the dialog associated with this action.
 
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
 

Constructor Detail

DialogCloseAction

public DialogCloseAction(JDialog dialog,
                         String name)
Constructs an action that will hide the dialog.


DialogCloseAction

public DialogCloseAction(JDialog dialog,
                         String name,
                         boolean dispose)
Constructs an action that will either hide or dispose the dialog.

Method Detail

setDialog

public void setDialog(JDialog dialog)
Sets the dialog associated with this action. This allows you to create the dialog with UIHelper.newModalDialog(javax.swing.JFrame, java.lang.String, javax.swing.JPanel, javax.swing.JButton...) and its ilk, which requires you to pass in a list of actions.


actionPerformed

public void actionPerformed(ActionEvent ignored)