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 :
OnClosevalue 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 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|
Construct a standard dialog.
|Modifier and Type||Method and Description|
Display the dialog.
Call dispose on the underlying dialog object.
Return the underlying dialog object.
Assign a default button for this 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 dialog
aIsModal- 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 closes
aBody- the body of the dialog, where the user enters information
aButtons- a row of buttons appearing at the bottom of this dialog
public 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