java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Dialog
Unsafe: A Dialog is a top-level window with a title and a border
that is typically used to take some form of input from the user.
The size of the dialog includes any area designated for the
border. The dimensions of the border area can be obtained
using the getInsets
method, however, since
these dimensions are platform-dependent, a valid insets
value cannot be obtained until the dialog is made displayable
by either calling pack
or show
.
Since the border area is included in the overall size of the
dialog, the border effectively obscures a portion of the dialog,
constraining the area available for rendering and/or displaying
subcomponents to the rectangle which has an upper-left corner
location of (insets.left, insets.top)
, and has a size of
width - (insets.left + insets.right)
by
height - (insets.top + insets.bottom)
.
The default layout for a dialog is BorderLayout
.
A dialog may have its native decorations (i.e. Frame & Titlebar) turned off
with setUndecorated
. This can only be done while the dialog
is not displayable
.
A dialog must have either a frame or another dialog defined as its owner when it's constructed. When the owner window of a visible dialog is minimized, the dialog will automatically be hidden from the user. When the owner window is subsequently restored, the dialog is made visible to the user again.
In a multi-screen environment, you can create a Dialog
on a different screen device than its owner. See java.awt.Frame
for
more information.
A dialog can be either modeless (the default) or modal. A modal dialog is one which blocks input to all other toplevel windows in the application, except for any windows created with the dialog as their owner.
Dialogs are capable of generating the following
WindowEvents
:
WindowOpened
, WindowClosing
,
WindowClosed
, WindowActivated
,
WindowDeactivated
, WindowGainedFocus
,
WindowLostFocus
.
WindowEvent
,
Window.addWindowListener(java.awt.event.WindowListener)
,
Serialized Form(package private) boolean
modal
private sun.awt.AppContext
showAppContext
inputContext, isFirstPack, OPENED, ownedWindowList, state, syncLWRequests, systemSyncLWRequests, warningString, windowFocusListener, windowListener, windowStateListener
component, containerListener, descendantsCount, INCLUDE_SELF, layoutMgr, listeningBoundsChildren, listeningChildren, ncomponents, SEARCH_HEAVYWEIGHTS
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, focusTraversalKeys, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, ignoreRepaint, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, mouseWheelListener, mouseWheelListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowFocusListenerK, windowListenerK, windowStateListenerK, x, y
Dialog(Dialog owner)
Dialog(Dialog owner,
String title)
Dialog(Dialog owner,
String title,
boolean modal)
Dialog
with the
specified owner dialog, title, and modality.
Dialog(Dialog owner,
String title,
boolean modal,
GraphicsConfiguration gc)
Dialog
with the
specified owner dialog, title, modality, and
GraphicsConfiguration
.
Dialog(Frame owner)
Dialog
with
an empty title and the specified owner frame.
Dialog(Frame owner,
boolean modal)
Dialog
with an empty title,
the specified owner frame and modality.
Dialog(Frame owner,
String title)
Dialog
with
the specified owner frame and title.
Dialog(Frame owner,
String title,
boolean modal)
Dialog
with the
specified owner frame, title, and modality.
Dialog(Frame owner,
String title,
boolean modal,
GraphicsConfiguration gc)
GraphicsConfiguration
.
void
addNotify()
void
dispose()
AccessibleContext
getAccessibleContext()
void
hide()
void
setUndecorated(boolean undecorated)
addOwnedWindow, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, adjustDecendantsOnParent, adjustListeningChildrenOnParent, applyResourceBundle, applyResourceBundle, clearMostRecentFocusOwnerOnHide, connectOwnedWindow, createBufferStrategy, createBufferStrategy, deliverMouseWheelToAncestor, dispatchEventImpl, dispatchMouseWheelToAncestor, eventEnabled, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, postProcessKeyEvent, postWindowEvent, preProcessKeyEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeOwnedWindow, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, resetGC, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
add, add, add, add, add, addContainerListener, addImpl, adjustDescendants, adjustListeningChildren, applyComponentOrientation, areFocusTraversalKeysSet, checkGD, clearCurrentFocusCycleRootOnHide, containsFocus, countComponents, countHierarchyMembers, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, get, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getContainerListeners, getDropTargetEventTarget, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, initializeFocusTraversalKeys, insets, invalidate, invalidateTree, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, iterate, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocusHelper, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, setZOrder, size, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, areInputMethodsEnabled, autoProcessMouseWheel, autoTransferFocus, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackBuffer, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeys_NoIDCheck, getFocusTraversalKeysEnabled, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusable, isFocusOwner, isFocusTraversable, isFocusTraversableOverridden, isFontSet, isForegroundSet, isLightweight, isOpaque, isRecursivelyVisible, 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, requestFocusHelper, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys_NoIDCheck, setFocusTraversalKeysEnabled, setForeground, setGCFromPeer, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, toString, transferFocus, transferFocus, transferFocusUpCycle, updateCursorImmediately
boolean resizable
setResizable()
boolean undecorated
undecorated
will be true if the dialog is
undecorated, otherwise it will be false.
#setUndecorated()
,
isUndecorated()
,
Component.isDisplayable()
boolean modal
isModal()
,
setModal()
String title
getTitle()
,
setTitle()
private transient boolean keepBlocking
private static final String base
private static int nameCounter
private static final long serialVersionUID
private sun.awt.AppContext showAppContext
public Dialog(Frame owner)
Dialog
with
an empty title and the specified owner frame.
owner
- the owner of the dialogjava.awt.GraphicsEnvironment#isHeadless
,
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Frame owner, boolean modal)
Dialog
with an empty title,
the specified owner frame and modality.
owner
- the owner of the dialogmodal
- if true
, dialog blocks input to other
app windows when shownjava.awt.GraphicsEnvironment#isHeadless
public Dialog(Frame owner, String title)
Dialog
with
the specified owner frame and title.
owner
- the owner of the dialogtitle
- the title of the dialog; a null
value
will be accepted without causing a
NullPointerException
to be thrownjava.awt.GraphicsEnvironment#isHeadless
,
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Frame owner, String title, boolean modal)
Dialog
with the
specified owner frame, title, and modality.
owner
- the owner of the dialogtitle
- the title of the dialog; a null
value
will be accepted without causing a
NullPointerException
to be thrownmodal
- if true, dialog blocks input to other app windows when shownjava.awt.GraphicsEnvironment#isHeadless
,
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
GraphicsConfiguration
.
owner
- the owner of the dialogtitle
- the title of the dialog. A null
value
will be accepted without causing a NullPointerException
to be thrown.modal
- if true, dialog blocks input to other app windows when showngc
- the GraphicsConfiguration
of the target screen device. If gc
is
null
, the same
GraphicsConfiguration
as the owning Frame is used.java.awt.GraphicsEnvironment#isHeadless
,
Component.setSize(int, int)
,
Component.setVisible(boolean)
public Dialog(Dialog owner)
owner
- the owner of the dialogjava.awt.GraphicsEnvironment#isHeadless
public Dialog(Dialog owner, String title)
owner
- the owner of the dialogtitle
- the title of the dialog. A null
value
will be accepted without causing a NullPointerException
to be thrown.java.awt.GraphicsEnvironment#isHeadless
public Dialog(Dialog owner, String title, boolean modal)
Dialog
with the
specified owner dialog, title, and modality.
owner
- the owner of the dialogtitle
- the title of the dialog; a null
value
will be accepted without causing a
NullPointerException
to be thrownmodal
- if true, dialog blocks input to other app windows when shownjava.awt.GraphicsEnvironment#isHeadless
public Dialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
Dialog
with the
specified owner dialog, title, modality, and
GraphicsConfiguration
.
owner
- the owner of the dialogtitle
- the title of the dialog; a null
value
will be accepted without causing a
NullPointerException
to be thrownmodal
- if true, dialog blocks input to other app windows when showngc
- the GraphicsConfiguration
of the target screen device; if gc
is
null
, the same
GraphicsConfiguration
as the owning Dialog is usedjava.awt.GraphicsEnvironment#isHeadless
,
Component.setSize(int, int)
,
Component.setVisible(boolean)
String constructComponentName()
constructComponentName
in class Window
public void addNotify()
public boolean isModal()
true
if this dialog window is modal;
false
otherwise.java.awt.Dialog#setModal
public void setModal(boolean b)
java.awt.Dialog#isModal
public String getTitle()
null
.java.awt.Dialog#setTitle
public void setTitle(String title)
title
- the title displayed in the dialog's border;
a null value results in an empty titlegetTitle()
private boolean conditionalShow()
public void show()
If the dialog is modal and is not already visible, this call will
not return until the dialog is hidden by calling hide
or
dispose
. It is permissible to show modal dialogs from
the event dispatching thread because the toolkit will ensure that
another event pump runs while the one which invoked this method
is blocked.
Component.hide()
,
Component.isDisplayable()
,
Component.validate()
,
java.awt.Dialog#isModal
void interruptBlocking()
private void hideAndDisposeHandler()
public void hide()
Window.show()
,
Window.dispose()
public void dispose()
Component.isDisplayable()
,
Window.pack()
,
Window.show()
private void disposeImpl()
public boolean isResizable()
true
if the user can resize the dialog;
false
otherwise.java.awt.Dialog#setResizable
public void setResizable(boolean resizable)
resizable
- true
if the user can
resize this dialog; false
otherwise.java.awt.Dialog#isResizable
public void setUndecorated(boolean undecorated)
undecorated
- true
if no dialog decorations are
to be enabled;
false
if dialog decorations are to be enabled.
IllegalComponentStateException
- if the dialog
is displayable.isUndecorated()
,
Component.isDisplayable()
public boolean isUndecorated()
true
if dialog is undecorated;
false
otherwise.java.awt.Dialog#setUndecorated
protected String paramString()
null
.
paramString
in class Container
private static void initIDs()
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Window