org.tigris.swidgets
Class Dialog
JDialog
org.tigris.swidgets.Dialog
- ActionListener
public abstract class Dialog
extends JDialog
implements ActionListener
Base class for all dialogs, setting borders and component spacing.
Dialog(Frame owner, String title, boolean modal) - Creates a new Dialog with no content component.
|
Dialog(Frame owner, String title, int theOptionType, boolean modal) - Creates a new Dialog with no content component, using the specified
optionType to determine the set of available buttons.
|
void | actionPerformed(ActionEvent e) - Default implementation simply closes the dialog when
any of the standard buttons is pressed except the Help button.
|
void | addButton(JButton button) - Adds a new button to the set of available option buttons on the dialog.
|
void | addButton(JButton button, int index) - Adds a new button to the set of available option buttons on the dialog.
|
protected JButton | getCancelButton()
|
protected JButton | getCloseButton()
|
protected int | getComponentGap()
|
JComponent | getContent() - Returns the main component that is displayed within the dialog.
|
protected JButton | getHelpButton()
|
protected int | getLabelGap()
|
protected JButton | getNoButton()
|
protected JButton | getOkButton()
|
protected JButton | getYesButton()
|
protected abstract void | nameButtons() - Subclasses may override this method to change the names and mnemonics of
the various JButtons which appear at the bottom of the dialog.
|
void | setContent(JComponent theContent) - Sets the main component to be displayed within the dialog.
|
CLOSE_OPTION
public static final int CLOSE_OPTION
Option type: CLOSE_OPTION
DEFAULT_OPTION
public static final int DEFAULT_OPTION
Option type: DEFAULT_OPTION
OK_CANCEL_HELP_OPTION
public static final int OK_CANCEL_HELP_OPTION
Option type: OK_CANCEL_HELP_OPTION
OK_CANCEL_OPTION
public static final int OK_CANCEL_OPTION
Option type: OK_CANCEL_OPTION
YES_NO_CANCEL_HELP_OPTION
public static final int YES_NO_CANCEL_HELP_OPTION
Option type: YES_NO_CANCEL_HELP_OPTION
YES_NO_CANCEL_OPTION
public static final int YES_NO_CANCEL_OPTION
Option type: YES_NO_CANCEL_OPTION
YES_NO_HELP_OPTION
public static final int YES_NO_HELP_OPTION
Option type: YES_NO_HELP_OPTION
YES_NO_OPTION
public static final int YES_NO_OPTION
Option type: YES_NO_OPTION
Dialog
public Dialog(Frame owner,
String title,
boolean modal)
Creates a new Dialog with no content component. The default set of
button(s) will be displayed. After creating the Dialog, call setContent()
to configure the dialog before calling show() to display it.
owner
- the owning Frametitle
- the title String for the dialogmodal
- true if the dialog is modal
Dialog
public Dialog(Frame owner,
String title,
int theOptionType,
boolean modal)
Creates a new Dialog with no content component, using the specified
optionType to determine the set of available buttons.
After creating the Dialog, call setContent()
to configure the dialog before calling show() to display it.
owner
- the owning Frametitle
- the title String for the dialogtheOptionType
- defines which buttons will be
available on the dialogmodal
- true if the dialog is modal
actionPerformed
public void actionPerformed(ActionEvent e)
Default implementation simply closes the dialog when
any of the standard buttons is pressed except the Help button.
java.awt.event.ActionListener.actionPerformed(java.awt.event.ActionEvent)
addButton
public void addButton(JButton button)
Adds a new button to the set of available option buttons on the dialog.
The button will appear after the buttons specified by the optionType.
button
- the button to add to the dialog.
addButton
public void addButton(JButton button,
int index)
Adds a new button to the set of available option buttons on the dialog.
The button will appear at the specified index.
button
- the button to add to the dialog.index
- index at which to insert new button (0 for first button)
getCancelButton
protected JButton getCancelButton()
getCloseButton
protected JButton getCloseButton()
getComponentGap
protected int getComponentGap()
- Returns the componentGap.
getContent
public JComponent getContent()
Returns the main component that is displayed within the dialog.
- main component displayed in dialog
getHelpButton
protected JButton getHelpButton()
getLabelGap
protected int getLabelGap()
getNoButton
protected JButton getNoButton()
getOkButton
protected JButton getOkButton()
getYesButton
protected JButton getYesButton()
nameButtons
protected abstract void nameButtons()
Subclasses may override this method to change the names and mnemonics of
the various JButtons which appear at the bottom of the dialog.
setContent
public final void setContent(JComponent theContent)
Sets the main component to be displayed within the dialog.
Note: this method is final because it is most likely to be used
in subclass constructors, and calling a class's overridable methods in
its own constructor is not good practice.
theContent
- main component to display in dialog