public final class StandardDialog extends Object
Using a standard class for all dialogs increases the uniformity of the application's appearance, and eliminates code repetition.
This standard dialog has the following characteristics :
OnClose
value passed to
the constructor
Taken individually, such policies are relatively minor. Taken as a group, they form an effective way of establish the overall feel of your application.
Login dialogs
Login dialogs represent a special case, since they have no parent JFrame. Thus, they
cannot inherit an icon. In JDK 6, this can be fixed, by adding a method to this class to
specify the icon.
In addition, closing a login dialog should cause the application to exit. However,
JDialog.setDefaultCloseOperation(int)
does not allow for that behavior, while
this class does.
This class does not extend JDialog
, since it
doesn't need to. As a pleasant side-effect of this choice, the javadoc for this
class is greatly simplified.
Constructor and Description |
---|
StandardDialog(JFrame aOwner,
String aTitle,
boolean aIsModal,
OnClose aOnClose,
JPanel aBody,
List<JButton> aButtons)
Construct a standard dialog.
|
public StandardDialog(JFrame aOwner, String aTitle, boolean aIsModal, OnClose aOnClose, JPanel aBody, List<JButton> aButtons)
aOwner
- the frame which is the owner/caller/parent of this dialog. This dialog
gets its icon and its position from the owner. Possibly null. It's strongly recommened to use
a non-null owner.aTitle
- the text to appear on the title bar of this dialogaIsModal
- controls whether this dialog is modal: if true, then this
dialog must be dismissed before you are allowed to return to the main window.aOnClose
- specifies desired behavior when this dialog closesaBody
- the body of the dialog, where the user enters informationaButtons
- a row of buttons appearing at the bottom of this dialogpublic void display()
The dialog is not automatically displayed in the constructor. This is because some callers may want to build a dialog upon startup, but only display it later. (Such a style might be chosen in order to slightly improve the apparent responsiveness of the application.)
public void setDefaultButton(JButton aButton)
public void dispose()
Copyright Hirondelle Systems - Generated 2013Sep20.11.16