java.awt
public class Dialog extends Window
Dialog
provides a top-level window normally used to receive
user input in applications.
A dialog always has another top-level window as owner and is only visible
if this owner is visible to the user. The default layout of dialogs is the
BorderLayout
. Dialogs can be modal (blocks user input to other
components) or non-modal (user input in other components are allowed).
Modifier and Type | Class and Description |
---|---|
protected class |
Dialog.AccessibleAWTDialog
Accessibility support for
Dialog . |
static class |
Dialog.ModalExclusionType |
static class |
Dialog.ModalityType |
Window.AccessibleAWTWindow
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Dialog(Dialog owner)
Initializes a new instance of
Dialog with the specified,
parent, that is resizable. |
Dialog(Dialog owner,
String title)
Initializes a new instance of
Dialog with the specified,
parent and title, that is resizable. |
Dialog(Dialog owner,
String title,
boolean modal)
Initializes a new instance of
Dialog with the specified,
parent, title and modality, that is resizable. |
Dialog(Dialog parent,
String title,
boolean modal,
GraphicsConfiguration gc)
Initializes a new instance of
Dialog with the specified,
parent, title, modality and GraphicsConfiguration , that is
resizable. |
Dialog(Frame parent)
Initializes a new instance of
Dialog with the specified
parent, that is resizable and not modal, and which has no title. |
Dialog(Frame parent,
boolean modal)
Initializes a new instance of
Dialog with the specified
parent and modality, that is resizable and which has no title. |
Dialog(Frame parent,
String title)
Initializes a new instance of
Dialog with the specified
parent, that is resizable and not modal, and which has the specified
title. |
Dialog(Frame parent,
String title,
boolean modal)
Initializes a new instance of
Dialog with the specified,
parent, title, and modality, that is resizable. |
Dialog(Frame parent,
String title,
boolean modal,
GraphicsConfiguration gc)
Initializes a new instance of
Dialog with the specified,
parent, title, modality and GraphicsConfiguration , that is
resizable. |
Modifier and Type | Method and Description |
---|---|
void |
addNotify()
Creates this object's native peer.
|
void |
dispose()
Disposes the Dialog and then causes show() to return if it is currently
blocked.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this
Dialog . |
String |
getTitle()
Returns the title of this dialog box.
|
void |
hide()
Deprecated.
Use
Component.setVisible(boolean) instead. |
boolean |
isModal()
Tests whether or not this dialog box is modal.
|
boolean |
isResizable()
Tests whether or not this dialog box is resizable.
|
boolean |
isUndecorated()
Returns whether this frame is undecorated or not.
|
protected String |
paramString()
Returns a debugging string for this component.
|
void |
setModal(boolean modal)
Changes the modality of this dialog box.
|
void |
setResizable(boolean resizable)
Changes the resizability of this dialog box.
|
void |
setTitle(String title)
Sets the title of this dialog box to the specified string.
|
void |
setUndecorated(boolean undecorated)
Disables or enables decorations for this frame.
|
void |
show()
Deprecated.
Use
Component.setVisible(boolean) instead. |
addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getGraphicsConfiguration, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Dialog(Frame parent)
Dialog
with the specified
parent, that is resizable and not modal, and which has no title.parent
- The parent frame of this dialog box.IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null. This exception is
always thrown when GraphicsEnvironment.isHeadless() returns true.public Dialog(Frame parent, boolean modal)
Dialog
with the specified
parent and modality, that is resizable and which has no title.parent
- The parent frame of this dialog box.modal
- true
if this dialog box is modal,
false
otherwise.IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null. This exception is
always thrown when GraphicsEnvironment.isHeadless() returns true.public Dialog(Frame parent, String title)
Dialog
with the specified
parent, that is resizable and not modal, and which has the specified
title.parent
- The parent frame of this dialog box.title
- The title string for this dialog box.IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null. This exceptionnis
always thrown when GraphicsEnvironment.isHeadless() returns true.public Dialog(Frame parent, String title, boolean modal)
Dialog
with the specified,
parent, title, and modality, that is resizable.parent
- The parent frame of this dialog box.title
- The title string for this dialog box.modal
- true
if this dialog box is modal,
false
otherwise.IllegalArgumentException
- If owner is null or
GraphicsEnvironment.isHeadless() returns true.public Dialog(Frame parent, String title, boolean modal, GraphicsConfiguration gc)
Dialog
with the specified,
parent, title, modality and GraphicsConfiguration
, that is
resizable.parent
- The parent frame of this dialog box.title
- The title string for this dialog box.modal
- true
if this dialog box is modal,
false
otherwise.gc
- The GraphicsConfiguration
object to use. If
null
the GraphicsConfiguration
of the target
frame is used.IllegalArgumentException
- If owner is null, the
GraphicsConfiguration is not a screen device or
GraphicsEnvironment.isHeadless() returns true.public Dialog(Dialog owner)
Dialog
with the specified,
parent, that is resizable.owner
- The parent frame of this dialog box.IllegalArgumentException
- If parent is null. This exception is
always thrown when GraphicsEnvironment.isHeadless() returns true.public Dialog(Dialog owner, String title)
Dialog
with the specified,
parent and title, that is resizable.owner
- The parent frame of this dialog box.title
- The title string for this dialog box.IllegalArgumentException
- If parent is null. This exception is
always thrown when GraphicsEnvironment.isHeadless() returns
true.public Dialog(Dialog owner, String title, boolean modal)
Dialog
with the specified,
parent, title and modality, that is resizable.owner
- The parent frame of this dialog box.title
- The title string for this dialog box.modal
- true
if this dialog box is modal,
false
otherwise.IllegalArgumentException
- If parent is null. This exception is
always thrown when GraphicsEnvironment.isHeadless() returns true.public Dialog(Dialog parent, String title, boolean modal, GraphicsConfiguration gc)
Dialog
with the specified,
parent, title, modality and GraphicsConfiguration
, that is
resizable.parent
- The parent frame of this dialog box.title
- The title string for this dialog box.modal
- true
if this dialog box is modal,
false
otherwise.gc
- The GraphicsConfiguration
object to use. If
null
the GraphicsConfiguration
of the target
frame is used.IllegalArgumentException
- If parent is null, the
GraphicsConfiguration is not a screen device or
GraphicsEnvironment.isHeadless() returns true.public String getTitle()
public void setTitle(String title)
title
- the new title. If null
an empty
title will be set.public boolean isModal()
true
if this dialog box is modal, false
otherwise.public void setModal(boolean modal)
modal
- true
to make this dialog box modal,
false
to make it non-modal.public boolean isResizable()
true
if this dialog is resizable,
false
otherwise.public void setResizable(boolean resizable)
resizable
- true
to make this dialog resizable,
false
to make it non-resizable.public void addNotify()
addNotify
in class Window
Component.isDisplayable()
,
Component.removeNotify()
public void show()
Component.setVisible(boolean)
instead.public void hide()
Component.setVisible(boolean)
instead.public void dispose()
protected String paramString()
paramString
in class Container
public boolean isUndecorated()
true
if this dialog is undecorated,
false
otherwise.public void setUndecorated(boolean undecorated)
undecorated
- true
to disable dialog decorations,
false
otherwise.IllegalComponentStateException
- If this frame is displayable.public AccessibleContext getAccessibleContext()
Dialog
. The
context is created, if necessary.getAccessibleContext
in interface Accessible
getAccessibleContext
in class Window