GeezerVison is showing docs.oracle.com — Dialog (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
protected class |
Dialog.AccessibleAWTDialog |
This class implements accessibility support for the
Dialog class.
|
static class |
Dialog.ModalExclusionType |
Any top-level window can be marked not to be blocked by modal
dialogs.
|
static class |
Dialog.ModalityType |
Modal dialogs block all input to some top-level windows.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
Dialog(Dialog owner) |
Constructs an initially invisible, modeless Dialog with
the specified owner Dialog and an empty title.
|
Dialog(Dialog owner,
String title) |
Constructs an initially invisible, modeless Dialog
with the specified owner Dialog and title.
|
Dialog(Dialog owner,
String title,
boolean modal) |
Constructs an initially invisible Dialog with the
specified owner Dialog, title, and modality.
|
Dialog(Dialog owner,
String title,
boolean modal,
GraphicsConfiguration gc) |
Constructs an initially invisible Dialog with the
specified owner Dialog, title, modality and
GraphicsConfiguration.
|
Dialog(Frame owner) |
Constructs an initially invisible, modeless Dialog with
the specified owner Frame and an empty title.
|
Dialog(Frame owner,
boolean modal) |
Constructs an initially invisible Dialog with the specified
owner Frame and modality and an empty title.
|
Dialog(Frame owner,
String title) |
Constructs an initially invisible, modeless Dialog with
the specified owner Frame and title.
|
Dialog(Frame owner,
String title,
boolean modal) |
Constructs an initially invisible Dialog with the
specified owner Frame, title and modality.
|
Dialog(Frame owner,
String title,
boolean modal,
GraphicsConfiguration gc) |
Constructs an initially invisible Dialog with the specified owner
Frame, title, modality, and GraphicsConfiguration.
|
Dialog(Window owner) |
Constructs an initially invisible, modeless Dialog with the
specified owner Window and an empty title.
|
Dialog(Window owner,
Dialog.ModalityType modalityType) |
Constructs an initially invisible Dialog with the
specified owner Window and modality and an empty title.
|
Dialog(Window owner,
String title) |
Constructs an initially invisible, modeless Dialog with
the specified owner Window and title.
|
Dialog(Window owner,
String title,
Dialog.ModalityType modalityType) |
Constructs an initially invisible Dialog with the
specified owner Window, title and modality.
|
Dialog(Window owner,
String title,
Dialog.ModalityType modalityType,
GraphicsConfiguration gc) |
Constructs an initially invisible Dialog with the
specified owner Window, title, modality and
GraphicsConfiguration.
|
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods
| Modifier and Type |
Method |
Description |
void |
addNotify() |
Makes this Dialog displayable by connecting it to
a native screen resource.
|
AccessibleContext |
getAccessibleContext() |
Gets the AccessibleContext associated with this Dialog.
|
Dialog.ModalityType |
getModalityType() |
Returns the modality type of this dialog.
|
String |
getTitle() |
Gets the title of the dialog.
|
void |
hide() |
|
boolean |
isModal() |
Indicates whether the dialog is modal.
|
boolean |
isResizable() |
Indicates whether this dialog is resizable by the user.
|
boolean |
isUndecorated() |
Indicates whether this dialog is undecorated.
|
protected String |
paramString() |
Returns a string representing the state of this dialog.
|
void |
setBackground(Color bgColor) |
Sets the background color of this window.
|
void |
setModal(boolean modal) |
Specifies whether this dialog should be modal.
|
void |
setModalityType(Dialog.ModalityType type) |
Sets the modality type for this dialog.
|
void |
setOpacity(float opacity) |
Sets the opacity of the window.
|
void |
setResizable(boolean resizable) |
Sets whether this dialog is resizable by the user.
|
void |
setShape(Shape shape) |
Sets the shape of the window.
|
void |
setTitle(String title) |
Sets the title of the Dialog.
|
void |
setUndecorated(boolean undecorated) |
Disables or enables decorations for this dialog.
|
void |
setVisible(boolean b) |
Shows or hides this Dialog depending on the value of parameter
b.
|
void |
show() |
|
void |
toBack() |
If this Window is visible, sends this Window to the back and may cause
it to lose focus or activation if it is the focused or active Window.
|
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
-
Methods inherited from class java.awt.Component
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, 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, 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, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
Field Detail
-
DEFAULT_MODALITY_TYPE
public static final Dialog.ModalityType DEFAULT_MODALITY_TYPE
Default modality type for modal dialogs. The default modality type is
APPLICATION_MODAL. Calling the oldstyle setModal(true)
is equal to setModalityType(DEFAULT_MODALITY_TYPE).
- Since:
- 1.6
- See Also:
Dialog.ModalityType,
setModal(boolean)
-
Constructor Detail
-
Dialog
public Dialog(Frame owner,
String title,
boolean modal)
Constructs an initially invisible Dialog with the
specified owner Frame, title and modality.
- Parameters:
owner - the owner of the dialog or null if
this dialog has no owner
title - the title of the dialog or null if this dialog
has no title
modal - specifies whether dialog blocks user input to other top-level
windows when shown. If false, the dialog is MODELESS;
if true, the modality type property is set to
DEFAULT_MODALITY_TYPE
- Throws:
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
- See Also:
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
DEFAULT_MODALITY_TYPE,
setModal(boolean),
setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)
-
Dialog
public Dialog(Frame owner,
String title,
boolean modal,
GraphicsConfiguration gc)
Constructs an initially invisible Dialog with the specified owner
Frame, title, modality, and GraphicsConfiguration.
- Parameters:
owner - the owner of the dialog or null if this dialog
has no owner
title - the title of the dialog or null if this dialog
has no title
modal - specifies whether dialog blocks user input to other top-level
windows when shown. If false, the dialog is MODELESS;
if true, the modality type property is set to
DEFAULT_MODALITY_TYPE
gc - the GraphicsConfiguration of the target screen device;
if null, the default system GraphicsConfiguration
is assumed
- Throws:
IllegalArgumentException - if gc
is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
- Since:
- 1.4
- See Also:
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
DEFAULT_MODALITY_TYPE,
setModal(boolean),
setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)
-
Dialog
public Dialog(Dialog owner)
Constructs an initially invisible, modeless Dialog with
the specified owner Dialog and an empty title.
- Parameters:
owner - the owner of the dialog or null if this
dialog has no owner
- Throws:
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
- Since:
- 1.2
- See Also:
GraphicsEnvironment.isHeadless()
-
Dialog
public Dialog(Dialog owner,
String title)
Constructs an initially invisible, modeless Dialog
with the specified owner Dialog and title.
- Parameters:
owner - the owner of the dialog or null if this
has no owner
title - the title of the dialog or null if this dialog
has no title
- Throws:
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
- Since:
- 1.2
- See Also:
GraphicsEnvironment.isHeadless()
-
Dialog
public Dialog(Dialog owner,
String title,
boolean modal)
Constructs an initially invisible Dialog with the
specified owner Dialog, title, and modality.
- Parameters:
owner - the owner of the dialog or null if this
dialog has no owner
title - the title of the dialog or null if this
dialog has no title
modal - specifies whether dialog blocks user input to other top-level
windows when shown. If false, the dialog is MODELESS;
if true, the modality type property is set to
DEFAULT_MODALITY_TYPE
- Throws:
IllegalArgumentException - if the owner's
GraphicsConfiguration is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
- Since:
- 1.2
- See Also:
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
DEFAULT_MODALITY_TYPE,
setModal(boolean),
setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless()
-
Dialog
public Dialog(Dialog owner,
String title,
boolean modal,
GraphicsConfiguration gc)
Constructs an initially invisible Dialog with the
specified owner Dialog, title, modality and
GraphicsConfiguration.
- Parameters:
owner - the owner of the dialog or null if this
dialog has no owner
title - the title of the dialog or null if this
dialog has no title
modal - specifies whether dialog blocks user input to other top-level
windows when shown. If false, the dialog is MODELESS;
if true, the modality type property is set to
DEFAULT_MODALITY_TYPE
gc - the GraphicsConfiguration of the target screen device;
if null, the default system GraphicsConfiguration
is assumed
- Throws:
IllegalArgumentException - if gc
is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
- Since:
- 1.4
- See Also:
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
DEFAULT_MODALITY_TYPE,
setModal(boolean),
setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
Component.setSize(int, int),
Component.setVisible(boolean)
-
Dialog
public Dialog(Window owner,
String title,
Dialog.ModalityType modalityType,
GraphicsConfiguration gc)
Constructs an initially invisible Dialog with the
specified owner Window, title, modality and
GraphicsConfiguration.
- Parameters:
owner - the owner of the dialog. The owner must be an instance of
Dialog, Frame, any
of their descendents or null
title - the title of the dialog or null if this dialog
has no title
modalityType - specifies whether dialog blocks input to other
windows when shown. null value and unsupported modality
types are equivalent to MODELESS
gc - the GraphicsConfiguration of the target screen device;
if null, the default system GraphicsConfiguration
is assumed
- Throws:
IllegalArgumentException - if the owner
is not an instance of Dialog or Frame
IllegalArgumentException - if gc
is not from a screen device
HeadlessException - when
GraphicsEnvironment.isHeadless() returns true
SecurityException - if the calling thread does not have permission
to create modal dialogs with the given modalityType
- Since:
- 1.6
- See Also:
Dialog.ModalityType,
setModal(boolean),
setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
Toolkit.isModalityTypeSupported(java.awt.Dialog.ModalityType)
-
Method Detail
-
toBack
public void toBack()
If this Window is visible, sends this Window to the back and may cause
it to lose focus or activation if it is the focused or active Window.
Places this Window at the bottom of the stacking order and shows it
behind any other Windows in this VM. No action will take place is this
Window is not visible. Some platforms do not allow Windows which are
owned by other Windows to appear below their owners. Every attempt will
be made to move this Window as low as possible in the stacking order;
however, developers should not assume that this method will move this
Window below all other windows in every situation.
Because of variations in native windowing systems, no guarantees about
changes to the focused and active Windows can be made. Developers must
never assume that this Window is no longer the focused or active Window
until this Window receives a WINDOW_LOST_FOCUS or WINDOW_DEACTIVATED
event. On platforms where the top-most window is the focused window,
this method will probably cause this Window to lose focus. In
that case, the next highest, focusable Window in this VM will receive
focus. On platforms where the stacking order does not typically affect
the focused window, this method will probably leave the focused
and active Windows unchanged.
If this dialog is modal and blocks some windows, then all of them are
also sent to the back to keep them below the blocking dialog.
- Overrides:
toBack in class Window
- See Also:
Window.toBack()
-
isResizable
public boolean isResizable()
Indicates whether this dialog is resizable by the user.
By default, all dialogs are initially resizable.
- Returns:
true if the user can resize the dialog;
false otherwise.
- See Also:
setResizable(boolean)
-
isUndecorated
public boolean isUndecorated()
Indicates whether this dialog is undecorated.
By default, all dialogs are initially decorated.
- Returns:
true if dialog is undecorated;
false otherwise.
- Since:
- 1.4
- See Also:
setUndecorated(boolean)
-
paramString
protected String paramString()
Returns a string representing the state of this dialog. This
method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null.
- Overrides:
paramString in class Container
- Returns:
- the parameter string of this dialog window.
-
getAccessibleContext
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Dialog.
For dialogs, the AccessibleContext takes the form of an
AccessibleAWTDialog.
A new AccessibleAWTDialog instance is created if necessary.
- Specified by:
getAccessibleContext in interface Accessible
- Overrides:
getAccessibleContext in class Window
- Returns:
- an AccessibleAWTDialog that serves as the
AccessibleContext of this Dialog
- Since:
- 1.3
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|