JOptionPane to create a variety of standard dialogs.
For information about creating dialogs, see
The Java Tutorial section
How
to Make Dialogs.
The JDialog component contains a JRootPane
as its only child.
The contentPane should be the parent of any children of the
JDialog.
As a convenience, the add, remove, and setLayout
methods of this class are overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to a dialog as follows:
dialog.add(child);
And the child will be added to the contentPane.
The contentPane is always non-null.
Attempting to set it to null generates an exception.
The default contentPane has a BorderLayout
manager set on it.
Refer to javax.swing.RootPaneContainer
for details on adding, removing and setting the LayoutManager
of a JDialog.
Please see the JRootPane documentation for a complete
description of the contentPane, glassPane,
and layeredPane components.
In a multi-screen environment, you can create a JDialog
on a different screen device than its owner. See java. for
more information.
Warning
Swing is not thread safe. For more information see Swing's Threading Policy.
Warning
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans package.
Please see java..
JOptionPane, JRootPane, javax.swing.RootPaneContainer
| Modifier and Type | Class and Description |
|---|---|
| protected class | JDialog.
This class implements accessibility support for the
|
| Modifier and Type | Field and Description |
|---|---|
| protected AccessibleContext | accessibleContext
Hides java. AccessibleContext associated with this JDialog
|
| private int | |
| private static boolean | |
| protected JRootPane | rootPane
The |
| protected boolean | rootPaneCheckingEnabled
If true then calls to |
| private TransferHandler | transferHandler
The |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | JDialog(Frame
the owner, boolean Frame from which the dialog is displayedspecifies whether dialog blocks user input to other top-level
windows when shown. If modal)true, the modality type property is set to
DEFAULT_MODALITY_TYPE, otherwise the dialog is modeless.Creates a dialog with an empty title and the specified modality and
|
| public | |
| public | JDialog(Frame
the owner, String Frame from which the dialog is displayedthe title, boolean String to display in the dialog's
title barspecifies whether dialog blocks user input to other top-level
windows when shown. If modal)true, the modality type property is set to
DEFAULT_MODALITY_TYPE otherwise the dialog is modelessCreates a dialog with the specified title, owner |
| public | JDialog(Frame
the owner, String Frame from which the dialog is displayedthe title, boolean String to display in the dialog's
title barspecifies whether dialog blocks user input to other top-level
windows when shown. If modal, GraphicsConfiguration true, the modality type property is set to
DEFAULT_MODALITY_TYPE, otherwise the dialog is modeless.the gc)GraphicsConfiguration of the target screen device;
if null, the default system GraphicsConfiguration
is assumedCreates a dialog with the specified title,
owner |
| public | |
| public | JDialog(Dialog
the owner owner, boolean Dialog from which the dialog is displayed
or null if this dialog has no ownerspecifies whether dialog blocks user input to other top-level
windows when shown. If modal)true, the modality type property is set to
DEFAULT_MODALITY_TYPE, otherwise the dialog is modeless.Creates a dialog with an empty title and the specified modality and
|
| public | |
| public | JDialog(Dialog
the owner owner, String Dialog from which the dialog is displayed
or null if this dialog has no ownerthe title, boolean String to display in the dialog's
title barspecifies whether dialog blocks user input to other top-level
windows when shown. If modal)true, the modality type property is set to
DEFAULT_MODALITY_TYPE, otherwise the dialog is modelessCreates a dialog with the specified title, modality
and the specified owner |
| public | JDialog(Dialog
the owner owner, String Dialog from which the dialog is displayed
or null if this dialog has no ownerthe title, boolean String to display in the dialog's
title barspecifies whether dialog blocks user input to other top-level
windows when shown. If modal, GraphicsConfiguration true, the modality type property is set to
DEFAULT_MODALITY_TYPE, otherwise the dialog is modelessthe gc)GraphicsConfiguration of the target screen device;
if null, the default system GraphicsConfiguration
is assumedCreates a dialog with the specified title, owner |
| public | |
| public | JDialog(Window
the owner, Dialog.Window from which the dialog is displayed or
null if this dialog has no ownerspecifies whether dialog blocks input to other
windows when shown. modalityTypenull value and unsupported modality
types are equivalent to MODELESSCreates a dialog with an empty title and the specified modality and
|
| public | |
| public | JDialog(Window
the owner, String Window from which the dialog is displayed or
null if this dialog has no ownerthe title, Dialog.String to display in the dialog's
title bar or null if the dialog has no titlespecifies whether dialog blocks input to other
windows when shown. modalityTypenull value and unsupported modality
types are equivalent to MODELESSCreates a dialog with the specified title, owner |
| public | JDialog(Window
the owner, String Window from which the dialog is displayed or
null if this dialog has no ownerthe title, Dialog.String to display in the dialog's
title bar or null if the dialog has no titlespecifies whether dialog blocks input to other
windows when shown. modalityType,null value and unsupported modality
types are equivalent to MODELESSthe gc)GraphicsConfiguration of the target screen device;
if null, the default system GraphicsConfiguration
is assumedCreates a dialog with the specified title, owner |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addImpl(Component
the component to be enhanced comp, Object the constraints to be respected constraints, int the index index)Overrides java. Adds the specified child |
| protected JRootPane | Returns: a newJRootPaneCalled by the constructor methods to create the default
|
| protected void | |
| public AccessibleContext | Returns: an AccessibleJDialog that serves as the AccessibleContext of this JDialogOverrides java. Implements javax. Gets the AccessibleContext associated with this JDialog. |
| public Container | Returns: thecontentPane propertyImplements javax. Returns the |
| public int | Returns: an integer indicating the window-close operationReturns the operation which occurs when the user initiates a "close" on this dialog. |
| public Component | Returns: theglassPane propertyImplements javax. Returns the |
| public Graphics | getGraphics()
Overrides java. Creates a graphics context for this component. |
| public JMenuBar | |
| public JLayeredPane | Returns: thelayeredPane propertyImplements javax. Returns the |
| public JRootPane | getRootPane()
Implements javax. Returns the |
| public TransferHandler | Returns: the value of thetransferHandler propertyImplements javax. Gets the |
| public static boolean | Returns: true if look and feel should provide Window decorations.Returns true if newly created |
| protected boolean | Returns: true ifadd and setLayout
are forwarded; false otherwiseReturns whether calls to |
| protected String | Returns: a string representation of thisJDialog.Overrides java. Returns a string representation of this |
| protected void | processWindowEvent(WindowEvent e)
Overrides java. Handles window events depending on the state of the
|
| public void | remove(Component
the component to be removed comp)Overrides java. Removes the specified component from the container. |
| public void | repaint(long
maximum time in milliseconds before update time, int the x coordinate x, int the y coordinate y, int the width width, int the height height)Overrides java. Repaints the specified rectangle of this component within
|
| public void | setContentPane(Container
the contentPane)contentPane object for this dialogImplements javax. Sets the |
| public void | setDefaultCloseOperation(int
the operation which should be performed when the
user closes the dialog operation)Sets the operation that will happen by default when the user initiates a "close" on this dialog. |
| public static void | setDefaultLookAndFeelDecorated(boolean
A hint as to whether or not current
look and feel should provide window decorations defaultLookAndFeelDecorated)Provides a hint as to whether or not newly created |
| public void | setGlassPane(Component
the glassPane)glassPane object for this dialogImplements javax. Sets the |
| public void | setJMenuBar(final JMenuBar
the menubar being placed in the dialog menu)Sets the menubar for this dialog. |
| public void | setLayeredPane(JLayeredPane
the new layeredPane)layeredPane propertyImplements javax. Sets the |
| public void | setLayout(LayoutManager
the manager)LayoutManagerOverrides java. Sets the |
| protected void | |
| protected void | setRootPaneCheckingEnabled(boolean
true if enabled)add and setLayout
are forwarded, false if they should operate directly on the
JDialog.Sets whether calls to |
| public void | setTransferHandler(TransferHandler
the new newHandler)TransferHandlerSets the |
| public void | update(Graphics
the g)Graphics context in which to paintOverrides java. Calls |