java.awt
Class Dialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
All Implemented Interfaces:
java.awt.image.ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
FileDialog

public class Dialog
extends Window

A dialog component is a top level window, . It resembles a frame, but has fewer properties. It does not have an icon or a settable cursor. In PersonalJava and Personal Profile implementations, the display of the title is optional.

A modal dialog, when visible, prevents the user from interacting with AWT components. A modeless dialog behaves more like a Frame. A Personal Profile Implementation must support modal dialogs. Multiple (nested) Modal Dialogs may be implemented so that only a single dialog is visible at a time: when a new modal is shown, it must become visible, and when it is dismissed, the previous modal dialog must be shown.

Nonmodal dialogs are optional in a Personal Profile implementation. If they are not supported, an UnsupportedOperationException is thrown when the consturctor is called and the system property java.awt.dialog.SupportsNonmodal is set to "false".

The modality of a dialog cannot be changed after the dialog has been created.

System Properties

The following system properties will be set to either "true" or "false" indicating which optional dialog features are supported by the Personal Profile implementation:
  • java.awt.dialog.SupportsNonmodal
  • java.awt.dialog.SupportsMultipleModal
  • java.awt.dialog.SupportsResize
  • java.awt.dialog.SupportsTitle

    Since:
    JDK1.0
    See Also:
    WindowEvent, Window.addWindowListener(java.awt.event.WindowListener), Serialized Form

    Field Summary
     
    Fields inherited from class java.awt.Component
    BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
     
    Fields inherited from interface java.awt.image.ImageObserver
    ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
     
    Constructor Summary
    Dialog(Frame parent)
              Creates a dialog.
    Dialog(Frame parent, boolean modal)
              Creates a dialog.
    Dialog(Frame parent, String title)
              Creates a dialog.
    Dialog(Frame parent, String title, boolean modal)
              Creates a dialog.
     
    Method Summary
     void dispose()
              Disposes the Dialog and then causes show() to return if it is currently blocked.
     String getTitle()
              Gets the title of the dialog.
     void hide()
              Hides the Dialog and then causes show() to return if it is currently blocked.
     boolean isModal()
              Indicates whether the dialog is modal.
     boolean isResizable()
              Indicates whether this dialog window is resizable.
    protected  String paramString()
              Returns the parameter string representing the state of this dialog window.
     void setModal(boolean modal)
              Specifies the modality of the dialog.
     void setResizable(boolean resizable)
              Sets the Resizable property of the dialog.
     void setTitle(String title)
              Sets the title of the Dialog.
     void show()
              Makes this dialog visible and in front of all windows.
     
    Methods inherited from class java.awt.Window
    addWindowListener, getFocusOwner, getGraphics, getInsets, getLocale, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, repaint, setBackground, setCursor, toBack, toFront, update, validate
     
    Methods inherited from class java.awt.Container
    add, add, add, add, add, addContainerListener, addImpl, addNotify, countComponents, deliverEvent, doLayout, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setLayout, validateTree
     
    Methods inherited from class java.awt.Component
    action, add, addComponentListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, getBackground, getBounds, getColorModel, getCursor, getFont, getFontMetrics, getForeground, getLocation, getLocationOnScreen, getName, getParent, getSize, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setBounds, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    Dialog

    public Dialog(Frame parent)
    Creates a dialog.

    Parameters:
    parent - the non null parent of the dialog
    Throws:
    UnsupportedOperationException - If the implementation does not support modeless dialogs.
    IllegalArgumentException - if the parent in null
    Since:
    JDK1.0
    See Also:
    Component.setSize(int, int), Component.setVisible(boolean)

    Dialog

    public Dialog(Frame parent,
                  boolean modal)
    Creates a dialog.

    Parameters:
    parent - the non null parent of the dialog
    modal - the modality of the dialog. If true the dialog is modal, otherwise it is modeless. If the implementation does not support modeless dialogs and modal is false, an UnsupportedOperationException should be thrown.
    Throws:
    UnsupportedOperationException - If the implementation does not support modeless dialogs.
    IllegalArgumentException - if the parent in null
    Since:
    JDK1.0
    See Also:
    Component.setSize(int, int), Component.setVisible(boolean)

    Dialog

    public Dialog(Frame parent,
                  String title)
    Creates a dialog.

    Parameters:
    parent - the non null parent of the dialog
    title - the title of the dialog
    Throws:
    UnsupportedOperationException - If the implementation does not support modeless dialogs.
    IllegalArgumentException - if the parent in null
    Since:
    JDK1.0
    See Also:
    Component.setSize(int, int), Component.setVisible(boolean)

    Dialog

    public Dialog(Frame parent,
                  String title,
                  boolean modal)
    Creates a dialog.

    Parameters:
    parent - the non null parent of the dialog
    title - the title of the dialog
    modal - the modality of the dialog. If true the dialog is modal, otherwise it is modeless. If the implementation does not support modeless dialogs and modal is false, an UnsupportedOperationException should be thrown.
    Throws:
    UnsupportedOperationException - If the implementation does not support modeless dialogs.
    IllegalArgumentException - if the parent in null
    Since:
    JDK1.0
    See Also:
    Component.setSize(int, int), Component.setVisible(boolean)
    Method Detail

    isModal

    public boolean isModal()
    Indicates whether the dialog is modal. A modal dialog grabs all input from the user.

    Returns:
    true if this dialog window is modal; false otherwise.
    Since:
    JDK1.0
    See Also:
    setModal(boolean)

    setModal

    public void setModal(boolean modal)
    Specifies the modality of the dialog. This method sets the modal property as specified by modal. A Personal Profile implementation may optionally support non-modal dialogs or not allow the modal property to be changed after the dialog is created. isModal() may be called to verify the setting of the modal property.

    Parameters:
    modal - desired modality for the dialog
    Since:
    JDK1.1
    See Also:
    isModal()

    getTitle

    public String getTitle()
    Gets the title of the dialog.

    Returns:
    the title of this dialog window.
    Since:
    JDK1.0
    See Also:
    setTitle(java.lang.String)

    setTitle

    public void setTitle(String title)
    Sets the title of the Dialog.

    Parameters:
    title - the new title being given to the dialog
    Since:
    JDK1.0
    See Also:
    getTitle()

    show

    public void show()
    Makes this dialog visible and in front of all windows. This method calls the dialog's addNotify() method, validates the dialog's layout, and makes the dialog visible.

    If the dialog is modal, show() will not return until the dialog is no longer visible.

    A Personal Profile or Personal Java implementation is not required to support multiple modal dialogs. In this case, if there is a previous modal dialog being shown, it can be hidden until this Dialog is made invisible via setVisible() or dispose(). This must work recursively to allow for multiple nested modal dialogs.

    Overrides:
    show in class Window
    Since:
    JDK1.0
    See Also:
    Component.setVisible(boolean)

    hide

    public void hide()
    Hides the Dialog and then causes show() to return if it is currently blocked.

    Overrides:
    hide in class Component

    dispose

    public void dispose()
    Disposes the Dialog and then causes show() to return if it is currently blocked.

    Overrides:
    dispose in class Window

    isResizable

    public boolean isResizable()
    Indicates whether this dialog window is resizable.

    Returns:
    true if the user can resize the dialog; false otherwise.
    Since:
    JDK1.0
    See Also:
    setResizable(boolean)

    setResizable

    public void setResizable(boolean resizable)
    Sets the Resizable property of the dialog. This method sets the resizable property of the dialog. A dilaog that is resizable may be resized by the user. In Personal Profile, this method may have no effect, it may be verified with the isResizable() method.

    Parameters:
    resizable - true if the user can resize this dialog; false otherwise.
    Since:
    JDK1.0
    See Also:
    isResizable()

    paramString

    protected String paramString()
    Returns the parameter string representing the state of this dialog window. This string is useful for debugging.

    Overrides:
    paramString in class Container
    Returns:
    the parameter string of this dialog window.
    Since:
    JDK1.0