JDialog (Java SE 15 & JDK 15) (original) (raw)
All Implemented Interfaces:
[ImageObserver](../../java/awt/image/ImageObserver.html "interface in java.awt.image")
, [MenuContainer](../../java/awt/MenuContainer.html "interface in java.awt")
, [Serializable](../../../java.base/java/io/Serializable.html "interface in java.io")
, [Accessible](../accessibility/Accessible.html "interface in javax.accessibility")
, [RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
, [WindowConstants](WindowConstants.html "interface in javax.swing")
@JavaBean(defaultProperty="JMenuBar", description="A toplevel window for creating dialog boxes.") public class JDialog extends Dialog implements WindowConstants, Accessible, RootPaneContainer
The main class for creating a dialog window. You can use this class to create a custom dialog, or invoke the many class methods in JOptionPane to create a variety of standard dialogs. For information about creating dialogs, see_The Java Tutorial_ sectionHow to Make Dialogs.
The JDialog
component contains a JRootPane
as its only child. The contentPane
should be the parent of any children of theJDialog
. 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 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 Frame 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 XMLEncoder.
Since:
1.2
See Also:
JOptionPane, JRootPane, RootPaneContainer
Nested Class Summary
Nested Classes
Modifier and Type | Class | Description |
---|---|---|
protected class | JDialog.AccessibleJDialog | This class implements accessibility support for theJDialog class. |
Field Summary
Fields
Modifier and Type | Field | Description |
---|---|---|
protected AccessibleContext | accessibleContext | AccessibleContext associated with this JDialog |
protected JRootPane | rootPane | |
protected boolean | rootPaneCheckingEnabled | If true then calls to add and setLayout will be forwarded to the contentPane. |
Constructor Summary
Constructors
Constructor | Description |
---|---|
JDialog() | Creates a modeless dialog without a title and without a specifiedFrame owner. |
JDialog(Dialog owner) | Creates a modeless dialog with the specified Dialog as its owner and an empty title. |
JDialog(Dialog owner, boolean modal) | Creates a dialog with an empty title and the specified modality andDialog as its owner. |
JDialog(Dialog owner,String title) | Creates a modeless dialog with the specified title and with the specified owner dialog. |
JDialog(Dialog owner,String title, boolean modal) | Creates a dialog with the specified title, modality and the specified owner Dialog. |
JDialog(Dialog owner,String title, boolean modal,GraphicsConfiguration gc) | Creates a dialog with the specified title, owner Dialog, modality and GraphicsConfiguration. |
JDialog(Frame owner) | Creates a modeless dialog with the specified Frame as its owner and an empty title. |
JDialog(Frame owner, boolean modal) | Creates a dialog with an empty title and the specified modality andFrame as its owner. |
JDialog(Frame owner,String title) | Creates a modeless dialog with the specified title and with the specified owner frame. |
JDialog(Frame owner,String title, boolean modal) | Creates a dialog with the specified title, owner Frame and modality. |
JDialog(Frame owner,String title, boolean modal,GraphicsConfiguration gc) | Creates a dialog with the specified title, owner Frame, modality and GraphicsConfiguration. |
JDialog(Window owner) | Creates a modeless dialog with the specified Window as its owner and an empty title. |
JDialog(Window owner,Dialog.ModalityType modalityType) | Creates a dialog with an empty title and the specified modality andWindow as its owner. |
JDialog(Window owner,String title) | Creates a modeless dialog with the specified title and ownerWindow. |
JDialog(Window owner,String title,Dialog.ModalityType modalityType) | Creates a dialog with the specified title, owner Window and modality. |
JDialog(Window owner,String title,Dialog.ModalityType modalityType,GraphicsConfiguration gc) | Creates a dialog with the specified title, owner Window, modality and GraphicsConfiguration. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
protected void | addImpl(Component comp,Object constraints, int index) | Adds the specified child Component. |
protected JRootPane | createRootPane() | Called by the constructor methods to create the defaultrootPane. |
protected void | dialogInit() | Called by the constructors to init the JDialog properly. |
AccessibleContext | getAccessibleContext() | Gets the AccessibleContext associated with this JDialog. |
Container | getContentPane() | Returns the contentPane object for this dialog. |
int | getDefaultCloseOperation() | Returns the operation which occurs when the user initiates a "close" on this dialog. |
Component | getGlassPane() | Returns the glassPane object for this dialog. |
Graphics | getGraphics() | Creates a graphics context for this component. |
JMenuBar | getJMenuBar() | Returns the menubar set on this dialog. |
JLayeredPane | getLayeredPane() | Returns the layeredPane object for this dialog. |
JRootPane | getRootPane() | Returns the rootPane object for this dialog. |
TransferHandler | getTransferHandler() | Gets the transferHandler property. |
static boolean | isDefaultLookAndFeelDecorated() | Returns true if newly created JDialogs should have their Window decorations provided by the current look and feel. |
protected boolean | isRootPaneCheckingEnabled() | Returns whether calls to add andsetLayout are forwarded to the contentPane. |
protected String | paramString() | Returns a string representation of this JDialog. |
protected void | processWindowEvent(WindowEvent e) | Handles window events depending on the state of thedefaultCloseOperation property. |
void | remove(Component comp) | Removes the specified component from the container. |
void | repaint(long time, int x, int y, int width, int height) | Repaints the specified rectangle of this component withintime milliseconds. |
void | setContentPane(Container contentPane) | Sets the contentPane property. |
void | setDefaultCloseOperation(int operation) | Sets the operation that will happen by default when the user initiates a "close" on this dialog. |
static void | setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) | Provides a hint as to whether or not newly created JDialogs should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel. |
void | setGlassPane(Component glassPane) | Sets the glassPane property. |
void | setJMenuBar(JMenuBar menu) | Sets the menubar for this dialog. |
void | setLayeredPane(JLayeredPane layeredPane) | Sets the layeredPane property. |
void | setLayout(LayoutManager manager) | Sets the LayoutManager. |
protected void | setRootPane(JRootPane root) | Sets the rootPane property. |
protected void | setRootPaneCheckingEnabled(boolean enabled) | Sets whether calls to add andsetLayout are forwarded to the contentPane. |
void | setTransferHandler(TransferHandler newHandler) | Sets the transferHandler property, which is a mechanism to support transfer of data into this component. |
void | update(Graphics g) | Calls paint(g). |
Methods declared in class java.awt.Dialog
[addNotify](../../java/awt/Dialog.html#addNotify%28%29), [getModalityType](../../java/awt/Dialog.html#getModalityType%28%29), [getTitle](../../java/awt/Dialog.html#getTitle%28%29), [hide](../../java/awt/Dialog.html#hide%28%29), [isModal](../../java/awt/Dialog.html#isModal%28%29), [isResizable](../../java/awt/Dialog.html#isResizable%28%29), [isUndecorated](../../java/awt/Dialog.html#isUndecorated%28%29), [setModal](../../java/awt/Dialog.html#setModal%28boolean%29), [setModalityType](../../java/awt/Dialog.html#setModalityType%28java.awt.Dialog.ModalityType%29), [setResizable](../../java/awt/Dialog.html#setResizable%28boolean%29), [setTitle](../../java/awt/Dialog.html#setTitle%28java.lang.String%29), [setUndecorated](../../java/awt/Dialog.html#setUndecorated%28boolean%29), [setVisible](../../java/awt/Dialog.html#setVisible%28boolean%29), [show](../../java/awt/Dialog.html#show%28%29), [toBack](../../java/awt/Dialog.html#toBack%28%29)
Methods declared in class java.awt.Window
[addPropertyChangeListener](../../java/awt/Window.html#addPropertyChangeListener%28java.beans.PropertyChangeListener%29), [addPropertyChangeListener](../../java/awt/Window.html#addPropertyChangeListener%28java.lang.String,java.beans.PropertyChangeListener%29), [addWindowFocusListener](../../java/awt/Window.html#addWindowFocusListener%28java.awt.event.WindowFocusListener%29), [addWindowListener](../../java/awt/Window.html#addWindowListener%28java.awt.event.WindowListener%29), [addWindowStateListener](../../java/awt/Window.html#addWindowStateListener%28java.awt.event.WindowStateListener%29), [applyResourceBundle](../../java/awt/Window.html#applyResourceBundle%28java.lang.String%29), [applyResourceBundle](../../java/awt/Window.html#applyResourceBundle%28java.util.ResourceBundle%29), [createBufferStrategy](../../java/awt/Window.html#createBufferStrategy%28int%29), [createBufferStrategy](../../java/awt/Window.html#createBufferStrategy%28int,java.awt.BufferCapabilities%29), [dispose](../../java/awt/Window.html#dispose%28%29), [getBackground](../../java/awt/Window.html#getBackground%28%29), [getBufferStrategy](../../java/awt/Window.html#getBufferStrategy%28%29), [getFocusableWindowState](../../java/awt/Window.html#getFocusableWindowState%28%29), [getFocusCycleRootAncestor](../../java/awt/Window.html#getFocusCycleRootAncestor%28%29), [getFocusOwner](../../java/awt/Window.html#getFocusOwner%28%29), [getFocusTraversalKeys](../../java/awt/Window.html#getFocusTraversalKeys%28int%29), [getIconImages](../../java/awt/Window.html#getIconImages%28%29), [getInputContext](../../java/awt/Window.html#getInputContext%28%29), [getListeners](../../java/awt/Window.html#getListeners%28java.lang.Class%29), [getLocale](../../java/awt/Window.html#getLocale%28%29), [getModalExclusionType](../../java/awt/Window.html#getModalExclusionType%28%29), [getMostRecentFocusOwner](../../java/awt/Window.html#getMostRecentFocusOwner%28%29), [getOpacity](../../java/awt/Window.html#getOpacity%28%29), [getOwnedWindows](../../java/awt/Window.html#getOwnedWindows%28%29), [getOwner](../../java/awt/Window.html#getOwner%28%29), [getOwnerlessWindows](../../java/awt/Window.html#getOwnerlessWindows%28%29), [getShape](../../java/awt/Window.html#getShape%28%29), [getToolkit](../../java/awt/Window.html#getToolkit%28%29), [getType](../../java/awt/Window.html#getType%28%29), [getWarningString](../../java/awt/Window.html#getWarningString%28%29), [getWindowFocusListeners](../../java/awt/Window.html#getWindowFocusListeners%28%29), [getWindowListeners](../../java/awt/Window.html#getWindowListeners%28%29), [getWindows](../../java/awt/Window.html#getWindows%28%29), [getWindowStateListeners](../../java/awt/Window.html#getWindowStateListeners%28%29), [isActive](../../java/awt/Window.html#isActive%28%29), [isAlwaysOnTop](../../java/awt/Window.html#isAlwaysOnTop%28%29), [isAlwaysOnTopSupported](../../java/awt/Window.html#isAlwaysOnTopSupported%28%29), [isAutoRequestFocus](../../java/awt/Window.html#isAutoRequestFocus%28%29), [isFocusableWindow](../../java/awt/Window.html#isFocusableWindow%28%29), [isFocusCycleRoot](../../java/awt/Window.html#isFocusCycleRoot%28%29), [isFocused](../../java/awt/Window.html#isFocused%28%29), [isLocationByPlatform](../../java/awt/Window.html#isLocationByPlatform%28%29), [isOpaque](../../java/awt/Window.html#isOpaque%28%29), [isShowing](../../java/awt/Window.html#isShowing%28%29), [isValidateRoot](../../java/awt/Window.html#isValidateRoot%28%29), [pack](../../java/awt/Window.html#pack%28%29), [paint](../../java/awt/Window.html#paint%28java.awt.Graphics%29), [postEvent](../../java/awt/Window.html#postEvent%28java.awt.Event%29), [processEvent](../../java/awt/Window.html#processEvent%28java.awt.AWTEvent%29), [processWindowFocusEvent](../../java/awt/Window.html#processWindowFocusEvent%28java.awt.event.WindowEvent%29), [processWindowStateEvent](../../java/awt/Window.html#processWindowStateEvent%28java.awt.event.WindowEvent%29), [removeWindowFocusListener](../../java/awt/Window.html#removeWindowFocusListener%28java.awt.event.WindowFocusListener%29), [removeWindowListener](../../java/awt/Window.html#removeWindowListener%28java.awt.event.WindowListener%29), [removeWindowStateListener](../../java/awt/Window.html#removeWindowStateListener%28java.awt.event.WindowStateListener%29), [reshape](../../java/awt/Window.html#reshape%28int,int,int,int%29), [setAlwaysOnTop](../../java/awt/Window.html#setAlwaysOnTop%28boolean%29), [setAutoRequestFocus](../../java/awt/Window.html#setAutoRequestFocus%28boolean%29), [setBackground](../../java/awt/Window.html#setBackground%28java.awt.Color%29), [setBounds](../../java/awt/Window.html#setBounds%28int,int,int,int%29), [setBounds](../../java/awt/Window.html#setBounds%28java.awt.Rectangle%29), [setCursor](../../java/awt/Window.html#setCursor%28java.awt.Cursor%29), [setFocusableWindowState](../../java/awt/Window.html#setFocusableWindowState%28boolean%29), [setFocusCycleRoot](../../java/awt/Window.html#setFocusCycleRoot%28boolean%29), [setIconImage](../../java/awt/Window.html#setIconImage%28java.awt.Image%29), [setIconImages](../../java/awt/Window.html#setIconImages%28java.util.List%29), [setLocation](../../java/awt/Window.html#setLocation%28int,int%29), [setLocation](../../java/awt/Window.html#setLocation%28java.awt.Point%29), [setLocationByPlatform](../../java/awt/Window.html#setLocationByPlatform%28boolean%29), [setLocationRelativeTo](../../java/awt/Window.html#setLocationRelativeTo%28java.awt.Component%29), [setMinimumSize](../../java/awt/Window.html#setMinimumSize%28java.awt.Dimension%29), [setModalExclusionType](../../java/awt/Window.html#setModalExclusionType%28java.awt.Dialog.ModalExclusionType%29), [setOpacity](../../java/awt/Window.html#setOpacity%28float%29), [setShape](../../java/awt/Window.html#setShape%28java.awt.Shape%29), [setSize](../../java/awt/Window.html#setSize%28int,int%29), [setSize](../../java/awt/Window.html#setSize%28java.awt.Dimension%29), [setType](../../java/awt/Window.html#setType%28java.awt.Window.Type%29), [toFront](../../java/awt/Window.html#toFront%28%29)
Methods declared in class java.awt.Container
[add](../../java/awt/Container.html#add%28java.awt.Component%29), [add](../../java/awt/Container.html#add%28java.awt.Component,int%29), [add](../../java/awt/Container.html#add%28java.awt.Component,java.lang.Object%29), [add](../../java/awt/Container.html#add%28java.awt.Component,java.lang.Object,int%29), [add](../../java/awt/Container.html#add%28java.lang.String,java.awt.Component%29), [addContainerListener](../../java/awt/Container.html#addContainerListener%28java.awt.event.ContainerListener%29), [applyComponentOrientation](../../java/awt/Container.html#applyComponentOrientation%28java.awt.ComponentOrientation%29), [areFocusTraversalKeysSet](../../java/awt/Container.html#areFocusTraversalKeysSet%28int%29), [countComponents](../../java/awt/Container.html#countComponents%28%29), [deliverEvent](../../java/awt/Container.html#deliverEvent%28java.awt.Event%29), [doLayout](../../java/awt/Container.html#doLayout%28%29), [findComponentAt](../../java/awt/Container.html#findComponentAt%28int,int%29), [findComponentAt](../../java/awt/Container.html#findComponentAt%28java.awt.Point%29), [getAlignmentX](../../java/awt/Container.html#getAlignmentX%28%29), [getAlignmentY](../../java/awt/Container.html#getAlignmentY%28%29), [getComponent](../../java/awt/Container.html#getComponent%28int%29), [getComponentAt](../../java/awt/Container.html#getComponentAt%28int,int%29), [getComponentAt](../../java/awt/Container.html#getComponentAt%28java.awt.Point%29), [getComponentCount](../../java/awt/Container.html#getComponentCount%28%29), [getComponents](../../java/awt/Container.html#getComponents%28%29), [getComponentZOrder](../../java/awt/Container.html#getComponentZOrder%28java.awt.Component%29), [getContainerListeners](../../java/awt/Container.html#getContainerListeners%28%29), [getFocusTraversalPolicy](../../java/awt/Container.html#getFocusTraversalPolicy%28%29), [getInsets](../../java/awt/Container.html#getInsets%28%29), [getLayout](../../java/awt/Container.html#getLayout%28%29), [getMaximumSize](../../java/awt/Container.html#getMaximumSize%28%29), [getMinimumSize](../../java/awt/Container.html#getMinimumSize%28%29), [getMousePosition](../../java/awt/Container.html#getMousePosition%28boolean%29), [getPreferredSize](../../java/awt/Container.html#getPreferredSize%28%29), [insets](../../java/awt/Container.html#insets%28%29), [invalidate](../../java/awt/Container.html#invalidate%28%29), [isAncestorOf](../../java/awt/Container.html#isAncestorOf%28java.awt.Component%29), [isFocusCycleRoot](../../java/awt/Container.html#isFocusCycleRoot%28java.awt.Container%29), [isFocusTraversalPolicyProvider](../../java/awt/Container.html#isFocusTraversalPolicyProvider%28%29), [isFocusTraversalPolicySet](../../java/awt/Container.html#isFocusTraversalPolicySet%28%29), [layout](../../java/awt/Container.html#layout%28%29), [list](../../java/awt/Container.html#list%28java.io.PrintStream,int%29), [list](../../java/awt/Container.html#list%28java.io.PrintWriter,int%29), [locate](../../java/awt/Container.html#locate%28int,int%29), [minimumSize](../../java/awt/Container.html#minimumSize%28%29), [paintComponents](../../java/awt/Container.html#paintComponents%28java.awt.Graphics%29), [preferredSize](../../java/awt/Container.html#preferredSize%28%29), [print](../../java/awt/Container.html#print%28java.awt.Graphics%29), [printComponents](../../java/awt/Container.html#printComponents%28java.awt.Graphics%29), [processContainerEvent](../../java/awt/Container.html#processContainerEvent%28java.awt.event.ContainerEvent%29), [remove](../../java/awt/Container.html#remove%28int%29), [removeAll](../../java/awt/Container.html#removeAll%28%29), [removeContainerListener](../../java/awt/Container.html#removeContainerListener%28java.awt.event.ContainerListener%29), [removeNotify](../../java/awt/Container.html#removeNotify%28%29), [setComponentZOrder](../../java/awt/Container.html#setComponentZOrder%28java.awt.Component,int%29), [setFocusTraversalKeys](../../java/awt/Container.html#setFocusTraversalKeys%28int,java.util.Set%29), [setFocusTraversalPolicy](../../java/awt/Container.html#setFocusTraversalPolicy%28java.awt.FocusTraversalPolicy%29), [setFocusTraversalPolicyProvider](../../java/awt/Container.html#setFocusTraversalPolicyProvider%28boolean%29), [setFont](../../java/awt/Container.html#setFont%28java.awt.Font%29), [transferFocusDownCycle](../../java/awt/Container.html#transferFocusDownCycle%28%29), [validate](../../java/awt/Container.html#validate%28%29), [validateTree](../../java/awt/Container.html#validateTree%28%29)
Methods declared in class java.awt.Component
[action](../../java/awt/Component.html#action%28java.awt.Event,java.lang.Object%29), [add](../../java/awt/Component.html#add%28java.awt.PopupMenu%29), [addComponentListener](../../java/awt/Component.html#addComponentListener%28java.awt.event.ComponentListener%29), [addFocusListener](../../java/awt/Component.html#addFocusListener%28java.awt.event.FocusListener%29), [addHierarchyBoundsListener](../../java/awt/Component.html#addHierarchyBoundsListener%28java.awt.event.HierarchyBoundsListener%29), [addHierarchyListener](../../java/awt/Component.html#addHierarchyListener%28java.awt.event.HierarchyListener%29), [addInputMethodListener](../../java/awt/Component.html#addInputMethodListener%28java.awt.event.InputMethodListener%29), [addKeyListener](../../java/awt/Component.html#addKeyListener%28java.awt.event.KeyListener%29), [addMouseListener](../../java/awt/Component.html#addMouseListener%28java.awt.event.MouseListener%29), [addMouseMotionListener](../../java/awt/Component.html#addMouseMotionListener%28java.awt.event.MouseMotionListener%29), [addMouseWheelListener](../../java/awt/Component.html#addMouseWheelListener%28java.awt.event.MouseWheelListener%29), [bounds](../../java/awt/Component.html#bounds%28%29), [checkImage](../../java/awt/Component.html#checkImage%28java.awt.Image,int,int,java.awt.image.ImageObserver%29), [checkImage](../../java/awt/Component.html#checkImage%28java.awt.Image,java.awt.image.ImageObserver%29), [coalesceEvents](../../java/awt/Component.html#coalesceEvents%28java.awt.AWTEvent,java.awt.AWTEvent%29), [contains](../../java/awt/Component.html#contains%28int,int%29), [contains](../../java/awt/Component.html#contains%28java.awt.Point%29), [createImage](../../java/awt/Component.html#createImage%28int,int%29), [createImage](../../java/awt/Component.html#createImage%28java.awt.image.ImageProducer%29), [createVolatileImage](../../java/awt/Component.html#createVolatileImage%28int,int%29), [createVolatileImage](../../java/awt/Component.html#createVolatileImage%28int,int,java.awt.ImageCapabilities%29), [disable](../../java/awt/Component.html#disable%28%29), [disableEvents](../../java/awt/Component.html#disableEvents%28long%29), [dispatchEvent](../../java/awt/Component.html#dispatchEvent%28java.awt.AWTEvent%29), [enable](../../java/awt/Component.html#enable%28%29), [enable](../../java/awt/Component.html#enable%28boolean%29), [enableEvents](../../java/awt/Component.html#enableEvents%28long%29), [enableInputMethods](../../java/awt/Component.html#enableInputMethods%28boolean%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,boolean,boolean%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,byte,byte%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,char,char%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,double,double%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,float,float%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,int,int%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,long,long%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,short,short%29), [firePropertyChange](../../java/awt/Component.html#firePropertyChange%28java.lang.String,java.lang.Object,java.lang.Object%29), [getBaseline](../../java/awt/Component.html#getBaseline%28int,int%29), [getBaselineResizeBehavior](../../java/awt/Component.html#getBaselineResizeBehavior%28%29), [getBounds](../../java/awt/Component.html#getBounds%28%29), [getBounds](../../java/awt/Component.html#getBounds%28java.awt.Rectangle%29), [getColorModel](../../java/awt/Component.html#getColorModel%28%29), [getComponentListeners](../../java/awt/Component.html#getComponentListeners%28%29), [getComponentOrientation](../../java/awt/Component.html#getComponentOrientation%28%29), [getCursor](../../java/awt/Component.html#getCursor%28%29), [getDropTarget](../../java/awt/Component.html#getDropTarget%28%29), [getFocusListeners](../../java/awt/Component.html#getFocusListeners%28%29), [getFocusTraversalKeysEnabled](../../java/awt/Component.html#getFocusTraversalKeysEnabled%28%29), [getFont](../../java/awt/Component.html#getFont%28%29), [getFontMetrics](../../java/awt/Component.html#getFontMetrics%28java.awt.Font%29), [getForeground](../../java/awt/Component.html#getForeground%28%29), [getGraphicsConfiguration](../../java/awt/Component.html#getGraphicsConfiguration%28%29), [getHeight](../../java/awt/Component.html#getHeight%28%29), [getHierarchyBoundsListeners](../../java/awt/Component.html#getHierarchyBoundsListeners%28%29), [getHierarchyListeners](../../java/awt/Component.html#getHierarchyListeners%28%29), [getIgnoreRepaint](../../java/awt/Component.html#getIgnoreRepaint%28%29), [getInputMethodListeners](../../java/awt/Component.html#getInputMethodListeners%28%29), [getInputMethodRequests](../../java/awt/Component.html#getInputMethodRequests%28%29), [getKeyListeners](../../java/awt/Component.html#getKeyListeners%28%29), [getLocation](../../java/awt/Component.html#getLocation%28%29), [getLocation](../../java/awt/Component.html#getLocation%28java.awt.Point%29), [getLocationOnScreen](../../java/awt/Component.html#getLocationOnScreen%28%29), [getMouseListeners](../../java/awt/Component.html#getMouseListeners%28%29), [getMouseMotionListeners](../../java/awt/Component.html#getMouseMotionListeners%28%29), [getMousePosition](../../java/awt/Component.html#getMousePosition%28%29), [getMouseWheelListeners](../../java/awt/Component.html#getMouseWheelListeners%28%29), [getName](../../java/awt/Component.html#getName%28%29), [getParent](../../java/awt/Component.html#getParent%28%29), [getPropertyChangeListeners](../../java/awt/Component.html#getPropertyChangeListeners%28%29), [getPropertyChangeListeners](../../java/awt/Component.html#getPropertyChangeListeners%28java.lang.String%29), [getSize](../../java/awt/Component.html#getSize%28%29), [getSize](../../java/awt/Component.html#getSize%28java.awt.Dimension%29), [getTreeLock](../../java/awt/Component.html#getTreeLock%28%29), [getWidth](../../java/awt/Component.html#getWidth%28%29), [getX](../../java/awt/Component.html#getX%28%29), [getY](../../java/awt/Component.html#getY%28%29), [gotFocus](../../java/awt/Component.html#gotFocus%28java.awt.Event,java.lang.Object%29), [handleEvent](../../java/awt/Component.html#handleEvent%28java.awt.Event%29), [hasFocus](../../java/awt/Component.html#hasFocus%28%29), [imageUpdate](../../java/awt/Component.html#imageUpdate%28java.awt.Image,int,int,int,int,int%29), [inside](../../java/awt/Component.html#inside%28int,int%29), [isBackgroundSet](../../java/awt/Component.html#isBackgroundSet%28%29), [isCursorSet](../../java/awt/Component.html#isCursorSet%28%29), [isDisplayable](../../java/awt/Component.html#isDisplayable%28%29), [isDoubleBuffered](../../java/awt/Component.html#isDoubleBuffered%28%29), [isEnabled](../../java/awt/Component.html#isEnabled%28%29), [isFocusable](../../java/awt/Component.html#isFocusable%28%29), [isFocusOwner](../../java/awt/Component.html#isFocusOwner%28%29), [isFocusTraversable](../../java/awt/Component.html#isFocusTraversable%28%29), [isFontSet](../../java/awt/Component.html#isFontSet%28%29), [isForegroundSet](../../java/awt/Component.html#isForegroundSet%28%29), [isLightweight](../../java/awt/Component.html#isLightweight%28%29), [isMaximumSizeSet](../../java/awt/Component.html#isMaximumSizeSet%28%29), [isMinimumSizeSet](../../java/awt/Component.html#isMinimumSizeSet%28%29), [isPreferredSizeSet](../../java/awt/Component.html#isPreferredSizeSet%28%29), [isValid](../../java/awt/Component.html#isValid%28%29), [isVisible](../../java/awt/Component.html#isVisible%28%29), [keyDown](../../java/awt/Component.html#keyDown%28java.awt.Event,int%29), [keyUp](../../java/awt/Component.html#keyUp%28java.awt.Event,int%29), [list](../../java/awt/Component.html#list%28%29), [list](../../java/awt/Component.html#list%28java.io.PrintStream%29), [list](../../java/awt/Component.html#list%28java.io.PrintWriter%29), [location](../../java/awt/Component.html#location%28%29), [lostFocus](../../java/awt/Component.html#lostFocus%28java.awt.Event,java.lang.Object%29), [mouseDown](../../java/awt/Component.html#mouseDown%28java.awt.Event,int,int%29), [mouseDrag](../../java/awt/Component.html#mouseDrag%28java.awt.Event,int,int%29), [mouseEnter](../../java/awt/Component.html#mouseEnter%28java.awt.Event,int,int%29), [mouseExit](../../java/awt/Component.html#mouseExit%28java.awt.Event,int,int%29), [mouseMove](../../java/awt/Component.html#mouseMove%28java.awt.Event,int,int%29), [mouseUp](../../java/awt/Component.html#mouseUp%28java.awt.Event,int,int%29), [move](../../java/awt/Component.html#move%28int,int%29), [nextFocus](../../java/awt/Component.html#nextFocus%28%29), [paintAll](../../java/awt/Component.html#paintAll%28java.awt.Graphics%29), [prepareImage](../../java/awt/Component.html#prepareImage%28java.awt.Image,int,int,java.awt.image.ImageObserver%29), [prepareImage](../../java/awt/Component.html#prepareImage%28java.awt.Image,java.awt.image.ImageObserver%29), [printAll](../../java/awt/Component.html#printAll%28java.awt.Graphics%29), [processComponentEvent](../../java/awt/Component.html#processComponentEvent%28java.awt.event.ComponentEvent%29), [processFocusEvent](../../java/awt/Component.html#processFocusEvent%28java.awt.event.FocusEvent%29), [processHierarchyBoundsEvent](../../java/awt/Component.html#processHierarchyBoundsEvent%28java.awt.event.HierarchyEvent%29), [processHierarchyEvent](../../java/awt/Component.html#processHierarchyEvent%28java.awt.event.HierarchyEvent%29), [processInputMethodEvent](../../java/awt/Component.html#processInputMethodEvent%28java.awt.event.InputMethodEvent%29), [processKeyEvent](../../java/awt/Component.html#processKeyEvent%28java.awt.event.KeyEvent%29), [processMouseEvent](../../java/awt/Component.html#processMouseEvent%28java.awt.event.MouseEvent%29), [processMouseMotionEvent](../../java/awt/Component.html#processMouseMotionEvent%28java.awt.event.MouseEvent%29), [processMouseWheelEvent](../../java/awt/Component.html#processMouseWheelEvent%28java.awt.event.MouseWheelEvent%29), [remove](../../java/awt/Component.html#remove%28java.awt.MenuComponent%29), [removeComponentListener](../../java/awt/Component.html#removeComponentListener%28java.awt.event.ComponentListener%29), [removeFocusListener](../../java/awt/Component.html#removeFocusListener%28java.awt.event.FocusListener%29), [removeHierarchyBoundsListener](../../java/awt/Component.html#removeHierarchyBoundsListener%28java.awt.event.HierarchyBoundsListener%29), [removeHierarchyListener](../../java/awt/Component.html#removeHierarchyListener%28java.awt.event.HierarchyListener%29), [removeInputMethodListener](../../java/awt/Component.html#removeInputMethodListener%28java.awt.event.InputMethodListener%29), [removeKeyListener](../../java/awt/Component.html#removeKeyListener%28java.awt.event.KeyListener%29), [removeMouseListener](../../java/awt/Component.html#removeMouseListener%28java.awt.event.MouseListener%29), [removeMouseMotionListener](../../java/awt/Component.html#removeMouseMotionListener%28java.awt.event.MouseMotionListener%29), [removeMouseWheelListener](../../java/awt/Component.html#removeMouseWheelListener%28java.awt.event.MouseWheelListener%29), [removePropertyChangeListener](../../java/awt/Component.html#removePropertyChangeListener%28java.beans.PropertyChangeListener%29), [removePropertyChangeListener](../../java/awt/Component.html#removePropertyChangeListener%28java.lang.String,java.beans.PropertyChangeListener%29), [repaint](../../java/awt/Component.html#repaint%28%29), [repaint](../../java/awt/Component.html#repaint%28int,int,int,int%29), [repaint](../../java/awt/Component.html#repaint%28long%29), [requestFocus](../../java/awt/Component.html#requestFocus%28%29), [requestFocus](../../java/awt/Component.html#requestFocus%28boolean%29), [requestFocus](../../java/awt/Component.html#requestFocus%28boolean,java.awt.event.FocusEvent.Cause%29), [requestFocus](../../java/awt/Component.html#requestFocus%28java.awt.event.FocusEvent.Cause%29), [requestFocusInWindow](../../java/awt/Component.html#requestFocusInWindow%28%29), [requestFocusInWindow](../../java/awt/Component.html#requestFocusInWindow%28boolean%29), [requestFocusInWindow](../../java/awt/Component.html#requestFocusInWindow%28java.awt.event.FocusEvent.Cause%29), [resize](../../java/awt/Component.html#resize%28int,int%29), [resize](../../java/awt/Component.html#resize%28java.awt.Dimension%29), [revalidate](../../java/awt/Component.html#revalidate%28%29), [setComponentOrientation](../../java/awt/Component.html#setComponentOrientation%28java.awt.ComponentOrientation%29), [setDropTarget](../../java/awt/Component.html#setDropTarget%28java.awt.dnd.DropTarget%29), [setEnabled](../../java/awt/Component.html#setEnabled%28boolean%29), [setFocusable](../../java/awt/Component.html#setFocusable%28boolean%29), [setFocusTraversalKeysEnabled](../../java/awt/Component.html#setFocusTraversalKeysEnabled%28boolean%29), [setForeground](../../java/awt/Component.html#setForeground%28java.awt.Color%29), [setIgnoreRepaint](../../java/awt/Component.html#setIgnoreRepaint%28boolean%29), [setLocale](../../java/awt/Component.html#setLocale%28java.util.Locale%29), [setMaximumSize](../../java/awt/Component.html#setMaximumSize%28java.awt.Dimension%29), [setMixingCutoutShape](../../java/awt/Component.html#setMixingCutoutShape%28java.awt.Shape%29), [setName](../../java/awt/Component.html#setName%28java.lang.String%29), [setPreferredSize](../../java/awt/Component.html#setPreferredSize%28java.awt.Dimension%29), [show](../../java/awt/Component.html#show%28boolean%29), [size](../../java/awt/Component.html#size%28%29), [toString](../../java/awt/Component.html#toString%28%29), [transferFocus](../../java/awt/Component.html#transferFocus%28%29), [transferFocusBackward](../../java/awt/Component.html#transferFocusBackward%28%29), [transferFocusUpCycle](../../java/awt/Component.html#transferFocusUpCycle%28%29)
Field Details
rootPane
See Also:
getRootPane(), setRootPane(javax.swing.JRootPane)rootPaneCheckingEnabled
protected boolean rootPaneCheckingEnabled
If true then calls toadd
andsetLayout
will be forwarded to thecontentPane
. This is initially false, but is set to true when theJDialog
is constructed.
See Also:
isRootPaneCheckingEnabled(), setRootPaneCheckingEnabled(boolean), RootPaneContaineraccessibleContext
AccessibleContext
associated with thisJDialog
Constructor Details
JDialog
public JDialog()
Creates a modeless dialog without a title and without a specifiedFrame
owner. A shared, hidden frame will be set as the owner of the dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
NOTE: This constructor does not allow you to create an unownedJDialog
. To create an unownedJDialog
you must use either theJDialog(Window)
orJDialog(Dialog)
constructor with an argument ofnull
.
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Frame owner)
Creates a modeless dialog with the specifiedFrame
as its owner and an empty title. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
NOTE: This constructor does not allow you to create an unownedJDialog
. To create an unownedJDialog
you must use either theJDialog(Window)
orJDialog(Dialog)
constructor with an argument ofnull
.
Parameters:
owner
- theFrame
from which the dialog is displayed
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Frame owner, boolean modal)
Creates a dialog with an empty title and the specified modality andFrame
as its owner. Ifowner
isnull
, a shared, hidden frame will be set as the owner of the dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
NOTE: This constructor does not allow you to create an unownedJDialog
. To create an unownedJDialog
you must use either theJDialog(Window)
orJDialog(Dialog)
constructor with an argument ofnull
.
Parameters:
owner
- theFrame
from which the dialog is displayed
modal
- specifies whether dialog blocks user input to other top-level windows when shown. Iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
, otherwise the dialog is modeless.
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a modeless dialog with the specified title and with the specified owner frame. If
owner
isnull
, a shared, hidden frame will be set as the owner of the dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
NOTE: This constructor does not allow you to create an unownedJDialog
. To create an unownedJDialog
you must use either theJDialog(Window)
orJDialog(Dialog)
constructor with an argument ofnull
.
Parameters:
owner
- theFrame
from which the dialog is displayed
title
- theString
to display in the dialog's title bar
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Frame owner,String title, boolean modal)
Creates a dialog with the specified title, ownerFrame
and modality. Ifowner
isnull
, a shared, hidden frame will be set as the owner of this dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
NOTE: Any popup components (JComboBox
,JPopupMenu
,JMenuBar
) created within a modal dialog will be forced to be lightweight.
NOTE: This constructor does not allow you to create an unownedJDialog
. To create an unownedJDialog
you must use either theJDialog(Window)
orJDialog(Dialog)
constructor with an argument ofnull
.
Parameters:
owner
- theFrame
from which the dialog is displayed
title
- theString
to display in the dialog's title bar
modal
- specifies whether dialog blocks user input to other top-level windows when shown. Iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
otherwise the dialog is modeless
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
Dialog.ModalityType, Dialog.ModalityType.MODELESS, Dialog.DEFAULT_MODALITY_TYPE, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a dialog with the specified title, owner
Frame
, modality andGraphicsConfiguration
. Ifowner
isnull
, a shared, hidden frame will be set as the owner of this dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
NOTE: Any popup components (JComboBox
,JPopupMenu
,JMenuBar
) created within a modal dialog will be forced to be lightweight.
NOTE: This constructor does not allow you to create an unownedJDialog
. To create an unownedJDialog
you must use either theJDialog(Window)
orJDialog(Dialog)
constructor with an argument ofnull
.
Parameters:
owner
- theFrame
from which the dialog is displayed
title
- theString
to display in the dialog's title bar
modal
- specifies whether dialog blocks user input to other top-level windows when shown. Iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
, otherwise the dialog is modeless.
gc
- theGraphicsConfiguration
of the target screen device; ifnull
, the default systemGraphicsConfiguration
is assumed
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
Since:
1.4
See Also:
Dialog.ModalityType, Dialog.ModalityType.MODELESS, Dialog.DEFAULT_MODALITY_TYPE, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Dialog owner)
Creates a modeless dialog with the specifiedDialog
as its owner and an empty title.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- the ownerDialog
from which the dialog is displayed ornull
if this dialog has no owner
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
-if GraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Dialog owner, boolean modal)
Creates a dialog with an empty title and the specified modality andDialog
as its owner.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- the ownerDialog
from which the dialog is displayed ornull
if this dialog has no owner
modal
- specifies whether dialog blocks user input to other top-level windows when shown. Iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
, otherwise the dialog is modeless.
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
Dialog.ModalityType, Dialog.ModalityType.MODELESS, Dialog.DEFAULT_MODALITY_TYPE, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a modeless dialog with the specified title and with the specified owner dialog.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- the ownerDialog
from which the dialog is displayed ornull
if this dialog has no owner
title
- theString
to display in the dialog's title bar
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Dialog owner,String title, boolean modal)
Creates a dialog with the specified title, modality and the specified ownerDialog
.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- the ownerDialog
from which the dialog is displayed ornull
if this dialog has no owner
title
- theString
to display in the dialog's title bar
modal
- specifies whether dialog blocks user input to other top-level windows when shown. Iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
, otherwise the dialog is modeless
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
See Also:
Dialog.ModalityType, Dialog.ModalityType.MODELESS, Dialog.DEFAULT_MODALITY_TYPE, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a dialog with the specified title, owner
Dialog
, modality andGraphicsConfiguration
.
NOTE: Any popup components (JComboBox
,JPopupMenu
,JMenuBar
) created within a modal dialog will be forced to be lightweight.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- the ownerDialog
from which the dialog is displayed ornull
if this dialog has no owner
title
- theString
to display in the dialog's title bar
modal
- specifies whether dialog blocks user input to other top-level windows when shown. Iftrue
, the modality type property is set toDEFAULT_MODALITY_TYPE
, otherwise the dialog is modeless
gc
- theGraphicsConfiguration
of the target screen device; ifnull
, the default systemGraphicsConfiguration
is assumed
Throws:
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- ifGraphicsEnvironment.isHeadless()
returnstrue
.
Since:
1.4
See Also:
Dialog.ModalityType, Dialog.ModalityType.MODELESS, Dialog.DEFAULT_MODALITY_TYPE, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
public JDialog(Window owner)
Creates a modeless dialog with the specifiedWindow
as its owner and an empty title.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- theWindow
from which the dialog is displayed ornull
if this dialog has no owner
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
is not an instance of Dialog or Frame
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
'sGraphicsConfiguration
is not from a screen device
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- whenGraphicsEnvironment.isHeadless()
returnstrue
Since:
1.6
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a dialog with an empty title and the specified modality and
Window
as its owner.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- theWindow
from which the dialog is displayed ornull
if this dialog has no owner
modalityType
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
is not an instance of Dialog or Frame
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
'sGraphicsConfiguration
is not from a screen device
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- whenGraphicsEnvironment.isHeadless()
returnstrue
[SecurityException](../../../java.base/java/lang/SecurityException.html "class in java.lang")
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
Since:
1.6
See Also:
Dialog.ModalityType, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a modeless dialog with the specified title and owner
Window
.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- theWindow
from which the dialog is displayed ornull
if this dialog has no owner
title
- theString
to display in the dialog's title bar ornull
if the dialog has no title
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
is not an instance of Dialog or Frame
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
'sGraphicsConfiguration
is not from a screen device
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- whenGraphicsEnvironment.isHeadless()
returnstrue
Since:
1.6
See Also:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a dialog with the specified title, owner
Window
and modality.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- theWindow
from which the dialog is displayed ornull
if this dialog has no owner
title
- theString
to display in the dialog's title bar ornull
if the dialog has no title
modalityType
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
is not an instance of Dialog or Frame
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
'sGraphicsConfiguration
is not from a screen device
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- whenGraphicsEnvironment.isHeadless()
returnstrue
[SecurityException](../../../java.base/java/lang/SecurityException.html "class in java.lang")
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
Since:
1.6
See Also:
Dialog.ModalityType, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()JDialog
Creates a dialog with the specified title, owner
Window
, modality andGraphicsConfiguration
.
NOTE: Any popup components (JComboBox
,JPopupMenu
,JMenuBar
) created within a modal dialog will be forced to be lightweight.
This constructor sets the component's locale property to the value returned byJComponent.getDefaultLocale
.
Parameters:
owner
- theWindow
from which the dialog is displayed ornull
if this dialog has no owner
title
- theString
to display in the dialog's title bar ornull
if the dialog has no title
modalityType
- specifies whether dialog blocks input to other windows when shown.null
value and unsupported modality types are equivalent toMODELESS
gc
- theGraphicsConfiguration
of the target screen device; ifnull
, the default systemGraphicsConfiguration
is assumed
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
is not an instance of Dialog or Frame
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if theowner
'sGraphicsConfiguration
is not from a screen device
[HeadlessException](../../java/awt/HeadlessException.html "class in java.awt")
- whenGraphicsEnvironment.isHeadless()
returnstrue
[SecurityException](../../../java.base/java/lang/SecurityException.html "class in java.lang")
- if the calling thread does not have permission to create modal dialogs with the givenmodalityType
Since:
1.6
See Also:
Dialog.ModalityType, Dialog.setModal(boolean), Dialog.setModalityType(java.awt.Dialog.ModalityType), GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()Method Details
dialogInit
protected void dialogInit()
Called by the constructors to init theJDialog
properly.createRootPane
Called by the constructor methods to create the default
rootPane
.
Returns:
a newJRootPane
processWindowEvent
protected void processWindowEvent(WindowEvent e)
Handles window events depending on the state of thedefaultCloseOperation
property.
Overrides:
[processWindowEvent](../../java/awt/Window.html#processWindowEvent%28java.awt.event.WindowEvent%29)
in class[Window](../../java/awt/Window.html "class in java.awt")
Parameters:
e
- the window event
See Also:
setDefaultCloseOperation(int)setDefaultCloseOperation
@BeanProperty(preferred=true,enumerationValues={"WindowConstants.DO_NOTHING_ON_CLOSE","WindowConstants.HIDE_ON_CLOSE","WindowConstants.DISPOSE_ON_CLOSE"},description="The dialog\'s default close operation.")public void setDefaultCloseOperation(int operation)
Sets the operation that will happen by default when the user initiates a "close" on this dialog. You must specify one of the following choices:
*DO_NOTHING_ON_CLOSE
(defined inWindowConstants
): Don't do anything; require the program to handle the operation in thewindowClosing
method of a registeredWindowListener
object.
*HIDE_ON_CLOSE
(defined inWindowConstants
): Automatically hide the dialog after invoking any registeredWindowListener
objects.
*DISPOSE_ON_CLOSE
(defined inWindowConstants
): Automatically hide and dispose the dialog after invoking any registeredWindowListener
objects.
The value is set toHIDE_ON_CLOSE
by default. Changes to the value of this property cause the firing of a property change event, with property name "defaultCloseOperation".
Note: When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.
Parameters:
operation
- the operation which should be performed when the user closes the dialog
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if defaultCloseOperation value isn't one of the above valid values
See Also:
Window.addWindowListener(java.awt.event.WindowListener), getDefaultCloseOperation(), WindowConstantsgetDefaultCloseOperation
public int getDefaultCloseOperation()
Returns the operation which occurs when the user initiates a "close" on this dialog.
Returns:
an integer indicating the window-close operation
See Also:
setDefaultCloseOperation(int)setTransferHandler
Sets the
transferHandler
property, which is a mechanism to support transfer of data into this component. Usenull
if the component does not support data transfer operations.
If the system propertysuppressSwingDropSupport
isfalse
(the default) and the current drop target on this component is eithernull
or not a user-set drop target, this method will change the drop target as follows: IfnewHandler
isnull
it will clear the drop target. If notnull
it will install a newDropTarget
.
Note: When used withJDialog
,TransferHandler
only provides data import capability, as the data export related methods are currently typed toJComponent
.
Please see How to Use Drag and Drop and Data Transfer, a section in_The Java Tutorial_, for more information.
Parameters:
newHandler
- the newTransferHandler
Since:
1.6
See Also:
TransferHandler, getTransferHandler(), Component.setDropTarget(java.awt.dnd.DropTarget)getTransferHandler
Gets the
transferHandler
property.
Returns:
the value of thetransferHandler
property
Since:
1.6
See Also:
TransferHandler, setTransferHandler(javax.swing.TransferHandler)update
Calls
paint(g)
. This method was overridden to prevent an unnecessary call to clear the background.
Overrides:
[update](../../java/awt/Container.html#update%28java.awt.Graphics%29)
in class[Container](../../java/awt/Container.html "class in java.awt")
Parameters:
g
- theGraphics
context in which to paint
See Also:
Component.update(Graphics)isRootPaneCheckingEnabled
protected boolean isRootPaneCheckingEnabled()
Returns whether calls toadd
andsetLayout
are forwarded to thecontentPane
.
Returns:
true ifadd
andsetLayout
are forwarded; false otherwise
See Also:
addImpl(java.awt.Component, java.lang.Object, int), setLayout(java.awt.LayoutManager), setRootPaneCheckingEnabled(boolean), RootPaneContainersetRootPaneCheckingEnabled
@BeanProperty(hidden=true,description="Whether the add and setLayout methods are forwarded")protected void setRootPaneCheckingEnabled(boolean enabled)
Sets whether calls toadd
andsetLayout
are forwarded to thecontentPane
.
Parameters:
enabled
- true ifadd
andsetLayout
are forwarded, false if they should operate directly on theJDialog
.
See Also:
addImpl(java.awt.Component, java.lang.Object, int), setLayout(java.awt.LayoutManager), isRootPaneCheckingEnabled(), RootPaneContaineraddImpl
protected void addImpl(Component comp,Object constraints, int index)
Adds the specified childComponent
. This method is overridden to conditionally forward calls to thecontentPane
. By default, children are added to thecontentPane
instead of the frame, refer to RootPaneContainer for details.
Overrides:
[addImpl](../../java/awt/Container.html#addImpl%28java.awt.Component,java.lang.Object,int%29)
in class[Container](../../java/awt/Container.html "class in java.awt")
Parameters:
comp
- the component to be enhanced
constraints
- the constraints to be respected
index
- the index
Throws:
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- ifindex
is invalid
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if adding the container's parent to itself
[IllegalArgumentException](../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- if adding a window to a container
See Also:
setRootPaneCheckingEnabled(boolean), RootPaneContainerremove
Removes the specified component from the container. If
comp
is not therootPane
, this will forward the call to thecontentPane
. This will do nothing ifcomp
is not a child of theJDialog
orcontentPane
.
Overrides:
[remove](../../java/awt/Container.html#remove%28java.awt.Component%29)
in class[Container](../../java/awt/Container.html "class in java.awt")
Parameters:
comp
- the component to be removed
Throws:
[NullPointerException](../../../java.base/java/lang/NullPointerException.html "class in java.lang")
- ifcomp
is null
See Also:
Container.add(java.awt.Component), RootPaneContainersetLayout
Sets the
LayoutManager
. Overridden to conditionally forward the call to thecontentPane
. Refer to RootPaneContainer for more information.
Overrides:
[setLayout](../../java/awt/Container.html#setLayout%28java.awt.LayoutManager%29)
in class[Container](../../java/awt/Container.html "class in java.awt")
Parameters:
manager
- theLayoutManager
See Also:
setRootPaneCheckingEnabled(boolean), RootPaneContainergetRootPane
Returns the
rootPane
object for this dialog.
Specified by:
[getRootPane](RootPaneContainer.html#getRootPane%28%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Returns:
this components single JRootPane child.
See Also:
setRootPane(javax.swing.JRootPane), RootPaneContainer.getRootPane()setRootPane
protected void setRootPane(JRootPane root)
Sets therootPane
property. This method is called by the constructor.
Parameters:
root
- therootPane
object for this dialog
See Also:
getRootPane()getContentPane
Returns the
contentPane
object for this dialog.
Specified by:
[getContentPane](RootPaneContainer.html#getContentPane%28%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Returns:
thecontentPane
property
See Also:
setContentPane(java.awt.Container), RootPaneContainer.getContentPane()setContentPane
@BeanProperty(bound=false,hidden=true,description="The client area of the dialog where child components are normally inserted.")public void setContentPane(Container contentPane)
Sets thecontentPane
property. This method is called by the constructor.
Swing's painting architecture requires an opaqueJComponent
in the containment hierarchy. This is typically provided by the content pane. If you replace the content pane it is recommended you replace it with an opaqueJComponent
.
Specified by:
[setContentPane](RootPaneContainer.html#setContentPane%28java.awt.Container%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Parameters:
contentPane
- thecontentPane
object for this dialog
Throws:
[IllegalComponentStateException](../../java/awt/IllegalComponentStateException.html "class in java.awt")
- (a runtime exception) if the content pane parameter isnull
See Also:
JRootPane, getContentPane(), RootPaneContainer.setContentPane(java.awt.Container)getLayeredPane
Returns the
layeredPane
object for this dialog.
Specified by:
[getLayeredPane](RootPaneContainer.html#getLayeredPane%28%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Returns:
thelayeredPane
property
See Also:
setLayeredPane(javax.swing.JLayeredPane), RootPaneContainer.getLayeredPane()setLayeredPane
Sets the
layeredPane
property. This method is called by the constructor.
Specified by:
[setLayeredPane](RootPaneContainer.html#setLayeredPane%28javax.swing.JLayeredPane%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Parameters:
layeredPane
- the newlayeredPane
property
Throws:
[IllegalComponentStateException](../../java/awt/IllegalComponentStateException.html "class in java.awt")
- (a runtime exception) if the layered pane parameter is null
See Also:
getLayeredPane(), RootPaneContainer.setLayeredPane(javax.swing.JLayeredPane)getGlassPane
Returns the
glassPane
object for this dialog.
Specified by:
[getGlassPane](RootPaneContainer.html#getGlassPane%28%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Returns:
theglassPane
property
See Also:
setGlassPane(java.awt.Component), RootPaneContainer.getGlassPane()setGlassPane
Sets the
glassPane
property. This method is called by the constructor.
Specified by:
[setGlassPane](RootPaneContainer.html#setGlassPane%28java.awt.Component%29)
in interface[RootPaneContainer](RootPaneContainer.html "interface in javax.swing")
Parameters:
glassPane
- theglassPane
object for this dialog
See Also:
getGlassPane(), RootPaneContainer.setGlassPane(java.awt.Component)getGraphics
Creates a graphics context for this component. This method will return
null
if this component is currently not displayable.
Overrides:
[getGraphics](../../java/awt/Component.html#getGraphics%28%29)
in class[Component](../../java/awt/Component.html "class in java.awt")
Returns:
a graphics context for this component, ornull
if it has none
Since:
1.6
See Also:
Component.paint(java.awt.Graphics)repaint
public void repaint(long time, int x, int y, int width, int height)
Repaints the specified rectangle of this component withintime
milliseconds. Refer toRepaintManager
for details on how the repaint is handled.
Overrides:
[repaint](../../java/awt/Component.html#repaint%28long,int,int,int,int%29)
in class[Component](../../java/awt/Component.html "class in java.awt")
Parameters:
time
- maximum time in milliseconds before update
x
- the x coordinate
y
- the y coordinate
width
- the width
height
- the height
Since:
1.6
See Also:
RepaintManagersetDefaultLookAndFeelDecorated
public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
Provides a hint as to whether or not newly createdJDialog
s should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel. IfdefaultLookAndFeelDecorated
is true, the currentLookAndFeel
supports providing window decorations, and the current window manager supports undecorated windows, then newly createdJDialog
s will have their Window decorations provided by the currentLookAndFeel
. Otherwise, newly createdJDialog
s will have their Window decorations provided by the current window manager.
You can get the same effect on a single JDialog by doing the following:
JDialog dialog = new JDialog();
dialog.setUndecorated(true);
dialog.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);Parameters:
defaultLookAndFeelDecorated
- A hint as to whether or not current look and feel should provide window decorations
Since:
1.4
See Also:
LookAndFeel.getSupportsWindowDecorations()isDefaultLookAndFeelDecorated
public static boolean isDefaultLookAndFeelDecorated()
Returns true if newly createdJDialog
s should have their Window decorations provided by the current look and feel. This is only a hint, as certain look and feels may not support this feature.
Returns:
true if look and feel should provide Window decorations.
Since:
1.4paramString
protected String paramString()
Returns a string representation of thisJDialog
. 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 benull
.
Overrides:
[paramString](../../java/awt/Dialog.html#paramString%28%29)
in class[Dialog](../../java/awt/Dialog.html "class in java.awt")
Returns:
a string representation of thisJDialog
.getAccessibleContext
Gets the AccessibleContext associated with this JDialog. For JDialogs, the AccessibleContext takes the form of an AccessibleJDialog. A new AccessibleJDialog instance is created if necessary.
Specified by:
[getAccessibleContext](../accessibility/Accessible.html#getAccessibleContext%28%29)
in interface[Accessible](../accessibility/Accessible.html "interface in javax.accessibility")
Overrides:
[getAccessibleContext](../../java/awt/Dialog.html#getAccessibleContext%28%29)
in class[Dialog](../../java/awt/Dialog.html "class in java.awt")
Returns:
an AccessibleJDialog that serves as the AccessibleContext of this JDialog