Class awt.MessageDialog
All Packages    This Package    Previous    Next

Class awt.MessageDialog

java.lang.Object
   |
   +----awt.MessageDialog

public class MessageDialog
extends Object
implements Dialog, DialogHandler
MessageDialog is a class that allows a modal or non-modal dialog to be presented to the user with a message. The dialog contains a picture, a message, and three buttons: ok, cancel, and help. The number of buttons as well as the labels they display can be controlled by the api.
See Also:
DialogHandler
Version:
1.8 31 Jan 1995
Author:
Sami Shaio

ERROR_TYPE
INFO_TYPE
QUESTION_TYPE
parent
The frame to which this dialog is attached to.

MessageDialog(Frame, String, String, int, int, boolean, String, String, String, DialogHandler)
Constructs a new MessageDialog.

cancelCallback(Dialog)
Invoked when the user presses the "Cancel" button.
dispose()
Dispose of this dialog.
helpCallback(Dialog)
Invoked when the user presses the "Help" button.
hide()
Hide this dialog
okCallback(Dialog)
Invoked when the user presses the "Ok" button.
setMessage(String)
Change the message associated with this dialog.
show()
Show this dialog.

INFO_TYPE
  public final static int INFO_TYPE
ERROR_TYPE
  public final static int ERROR_TYPE
QUESTION_TYPE
  public final static int QUESTION_TYPE
parent
  public Frame parent
The frame to which this dialog is attached to.

MessageDialog
  public MessageDialog(Frame f,
                       String title,
                       String message,
                       int dialogType,
                       int nButtons,
                       boolean isModal,
                       String okLabel,
                       String cancelLabel,
                       String helpLabel,
                       DialogHandler handler)
Constructs a new MessageDialog.
Parameters:
f - is the frame that is to be the parent of this MessageDialog.
title - is the title of the dialog. It can be null.
message - is the message to display in the dialog. It can be changed later with setMessage.
dialogType - is one of INFO_TYPE (for information dialogs), ERROR_TYPE (for an error dialog), or QUESTION_TYPE (for a question dialog).
nButtons - is the number of buttons to use. It is a number from 1 to 3. The number corresponds to whether the buttons should be ok (1), ok and cancel (2), or ok, cancel, and help (3).
isModal - determines whether the dialog will block all user input until the dialog is disposed of by clicking one of the ok or cancel buttons.
okLabel - is the label to use for the Ok button. If null, then a default string will be chosen.
cancelLabel - is the label to use for the Cancel button. If null, then a default string will be chosen.
helpLabel - is the label to use for the Help button. If null, then a default string will be chosen.
handler - is the object that will handle the callbacks for the buttons listed in the dialog. It may be null in which case a default action is taken for all the buttons.

setMessage
  public void setMessage(String message)
Change the message associated with this dialog.

show

  public int show()
Show this dialog.
Returns:
the number of the button that was pressed if this dialog is modal. Otherwise -1 is returned.

hide

  public void hide()
Hide this dialog

dispose

  public void dispose()
Dispose of this dialog.

okCallback

  public void okCallback(Dialog m)
Invoked when the user presses the "Ok" button.

cancelCallback

  public void cancelCallback(Dialog m)
Invoked when the user presses the "Cancel" button.

helpCallback

  public void helpCallback(Dialog m)
Invoked when the user presses the "Help" button.


All Packages    This Package    Previous    Next