net.sf.swinglib.actions
Class DialogCloseAction
java.lang.Object
javax.swing.AbstractAction
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
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.
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)