java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Dialog
public class Dialog
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 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
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
. Methods inherited from class java.awt.Window addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, 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, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
Dialog
public Dialog(Frame owner)
Dialog
with an empty title and the specified owner frame.
owner
- the owner of the dialog
IllegalArgumentException
- if the owner
's GraphicsConfiguration
is not from a screen device
IllegalArgumentException
- if owner
is null
; this exception is always thrown when GraphicsEnvironment.isHeadless
returns true
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 dialog
modal
- if true
, dialog blocks input to other app windows when shown
IllegalArgumentException
- if the owner
's GraphicsConfiguration
is not from a screen device
IllegalArgumentException
- if owner
is null
; this exception is always thrown when GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public Dialog(Frame owner, String title)
Dialog
with the specified owner frame and title.
owner
- the owner of the dialog
title
- the title of the dialog; a null
value will be accepted without causing a NullPointerException
to be thrown
IllegalArgumentException
- if the owner
's GraphicsConfiguration
is not from a screen device
IllegalArgumentException
- if owner
is null
; this exception is always thrown when GraphicsEnvironment.isHeadless
returns true
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 dialog
title
- 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 shown
IllegalArgumentException
- if the owner
's GraphicsConfiguration
is not from a screen device
IllegalArgumentException
- if owner
is null
. This exception is always thrown when GraphicsEnvironment.isHeadless
returns true
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 dialog
title
- 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 shown
gc
- the GraphicsConfiguration
of the target screen device. If gc
is null
, the same GraphicsConfiguration
as the owning Frame is used.
IllegalArgumentException
- if owner
is null
. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
, Component.setSize(int, int)
, Component.setVisible(boolean)
public Dialog(Dialog owner)
owner
- the owner of the dialog
IllegalArgumentException
- if owner
is null
. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public Dialog(Dialog owner, String title)
owner
- the owner of the dialog
title
- the title of the dialog. A null
value will be accepted without causing a NullPointerException to be thrown.
IllegalArgumentException
- if owner
is null
. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public Dialog(Dialog owner, String title, boolean modal)
Dialog
with the specified owner dialog, title, and modality.
owner
- the owner of the dialog
title
- 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 shown
IllegalArgumentException
- if the owner
's GraphicsConfiguration
is not from a screen device
IllegalArgumentException
- if owner
is null
; this exception is always thrown when GraphicsEnvironment.isHeadless
returns true
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 dialog
title
- 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 shown
gc
- the GraphicsConfiguration
of the target screen device; if gc
is null
, the same GraphicsConfiguration
as the owning Dialog is used
IllegalArgumentException
- if the owner
's GraphicsConfiguration
is not from a screen device
IllegalArgumentException
- if owner
is null
; this exception is always thrown when GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
, Component.setSize(int, int)
, Component.setVisible(boolean)
public void addNotify()
addNotify
in class Window
Component.isDisplayable()
, Container.removeNotify()
public boolean isModal()
true
if this dialog window is modal; false
otherwise.
setModal(boolean)
public void setModal(boolean b)
isModal()
public String getTitle()
null
.
setTitle(java.lang.String)
public void setTitle(String title)
title
- the title displayed in the dialog's border; a null value results in an empty title
getTitle()
@Deprecated public void show()
Component.setVisible(boolean)
.
show
in class Window
@Deprecated public void hide()
Component.setVisible(boolean)
.
hide
in class Window
public boolean isResizable()
true
if the user can resize the dialog; false
otherwise.
setResizable(boolean)
public void setResizable(boolean resizable)
resizable
- true
if the user can resize this dialog; false
otherwise.
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.
setUndecorated(boolean)
protected String paramString()
null
.
paramString
in class Container
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Window
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4