    All Packages    This Package    Previous    Next

# Class awt.StringDialog

    java.lang.Object
       |
       +----awt.Component
               |
               +----awt.Container
                       |
                       +----awt.Frame
                               |
                               +----awt.StringDialog

public class StringDialog
extends Frame
implements Dialog, DialogHandler

StringDialog is a class that presents a dialog box to the user. It contains a picture (well, not yet!), a message, a text input area, and up to three buttons: ok, cancel, and help. The number of buttons and the button labels can be controlled by the API. The contents of the text field can be retrieved through it.

See Also:
  DialogHandler
Version:
  1.8 22 Feb 1995
Author:
  Herb Jellinek

##

stdHeight
stdWidth

##

StringDialog(Frame, Font, String, String, boolean, boolean, String, String, String, String, DialogHandler)
  Constructs a new StringDialog.

##

cancelCallback(Dialog)
  Invoked when the user presses the "Cancel" button.
dispose()
  Dispose of this dialog.
getText()
  Get the text from the text input field.
helpCallback(Dialog)
  Invoked when the user presses the "Help" button.
hide()
  Hide this dialog
okCallback(Dialog)
  Invoked when the user presses the "Ok" button.
setHandler(DialogHandler)
  Set this dialog's handler.
setMessage(String)
  Change the message associated with this dialog.
setText(String)
  Set the text in the text input field.
show()
  Show this dialog.

##

stdWidth

      public static int stdWidth

stdHeight

      public static int stdHeight

##

StringDialog

      public StringDialog(Frame f,
                          Font font,
                          String title,
                          String messageStr,
                          boolean wantHelp,
                          boolean isModal,
                          String okLabel,
                          String cancelLabel,
                          String helpLabel,
                          String initialText,
                          DialogHandler handler)

  Constructs a new StringDialog.
  Parameters:
    f - is the frame that is to be the parent of this StringDialog.
    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). !! Currently ignored !!
    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. !! Currently ignored !!
    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 Ok button. If null, then a default string will be chosen.
    helpLabel - is the label to use for the Ok button. If null, then a default string will be chosen.
    initialText - is the text to preload into the text input field. If null, field will be empty.
    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.

##

setHandler

      public void setHandler(DialogHandler dh)

  Set this dialog's handler.

setMessage

      public void setMessage(String msg)

  Change the message associated with this dialog.

getText

      public String getText()

  Get the text from the text input field.

setText

      public void setText(String text)

  Set the text in the text input field.

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.
  Overrides:
    dispose in class Frame

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