|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbuoy.widget.BStandardDialog
public class BStandardDialog
BStandardDialog is used for displaying a variety of "standard" modal dialogs which display messages or ask for simple types of input. Most platforms define a standardized appearance for such dialogs (the layout, the use of particular icons, etc.), and this class will automatically create dialogs which look correct for the current platform.
BStandardDialog does not extend Widget. It is a fully self contained user interface element. You simply create the BStandardDialog and call an appropriate method to display it. That method blocks until the dialog has been dismissed, then returns whatever input was entered by the user.
There are three different methods to show a dialog, which correspond to the three major types of dialog which can be shown:
showMessageDialog()
simply displays a
message to the user, and blocks until they click the "OK" button.showOptionDialog()
displays a message
and offers two or three buttons for the user to choose from. It blocks until the user clicks
one of the buttons, then returns the index of the button they selected.showInputDialog()
displays a message
and gives the user space to enter a value. The value may be unrestricted, in which case they
are given a text field to type the value, or it may be restricted to a list of allowed values,
in which case they are given a list or combo box from which to select a value. It blocks until
the user clicks the "OK" or "Cancel" button, then returns the value they entered.toString()
on them.
Nested Class Summary | |
---|---|
static class |
BStandardDialog.Style
This inner class represents a style for the dialog. |
Field Summary | |
---|---|
static BStandardDialog.Style |
ERROR
|
static BStandardDialog.Style |
INFORMATION
|
static BStandardDialog.Style |
PLAIN
|
static BStandardDialog.Style |
QUESTION
|
static BStandardDialog.Style |
WARNING
|
Constructor Summary | |
---|---|
BStandardDialog()
Create a new BStandardDialog with no message whose style is PLAIN. |
|
BStandardDialog(java.lang.String title,
java.lang.Object message,
BStandardDialog.Style style)
Create a new BStandardDialog. |
Method Summary | |
---|---|
java.lang.Object |
getMessage()
Get the message displayed in the dialog. |
BStandardDialog.Style |
getStyle()
Get the style of the dialog. |
java.lang.String |
getTitle()
Get the title displayed on the dialog. |
void |
setMessage(java.lang.Object message)
Set the message displayed in the dialog. |
void |
setStyle(BStandardDialog.Style style)
Set the style of the dialog. |
void |
setTitle(java.lang.String title)
Set the title displayed on the dialog. |
java.lang.String |
showInputDialog(Widget parent,
java.lang.String[] options,
java.lang.String defaultVal)
Show a dialog which contains the message and space for the user to enter value. |
void |
showMessageDialog(Widget parent)
Show a dialog which contains the message. |
int |
showOptionDialog(Widget parent,
java.lang.String[] options,
java.lang.String defaultVal)
Show a dialog which contains the message and two or three buttons to choose from. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final BStandardDialog.Style ERROR
public static final BStandardDialog.Style INFORMATION
public static final BStandardDialog.Style WARNING
public static final BStandardDialog.Style QUESTION
public static final BStandardDialog.Style PLAIN
Constructor Detail |
---|
public BStandardDialog()
public BStandardDialog(java.lang.String title, java.lang.Object message, BStandardDialog.Style style)
title
- the title to display on the dialogmessage
- the message to display inside the dialogstyle
- the style of the dialog to displayMethod Detail |
---|
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
public java.lang.Object getMessage()
public void setMessage(java.lang.Object message)
public BStandardDialog.Style getStyle()
public void setStyle(BStandardDialog.Style style)
public void showMessageDialog(Widget parent)
parent
- the dialog's parent Widget (usually a WindowWidget). This may be null.public int showOptionDialog(Widget parent, java.lang.String[] options, java.lang.String defaultVal)
parent
- the dialog's parent Widget (usually a WindowWidget). This may be null.options
- the list of labels to display on the buttons. This must be of length 2 or 3.defaultVal
- the option which should be shown as the default value
public java.lang.String showInputDialog(Widget parent, java.lang.String[] options, java.lang.String defaultVal)
parent
- the dialog's parent Widget (usually a WindowWidget). This may be null.options
- the list of allowed values. This may be null, in which case the user is
free to enter any value.defaultVal
- the default value when the dialog first appears
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |