javax.swing
Class JDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class JDialog
extends Dialog
implements Accessible, WindowConstants, RootPaneContainer

A dialog window. This is an extension of Dialog that provides support for the Swing architecture. Most importantly it contains a JRootPane as it's only top-level child, that manages the content pane, the menu and a glass pane. Also, unlike java.awt.Dialogs, JDialogs support the Swing Pluggable Look & Feel architecture.

See Also:
Serialized Form

Nested Class Summary
protected  class JDialog.AccessibleJDialog
          Provides accessibility support for JDialogs.
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  AccessibleContext accessibleContext
          DOCUMENT ME!
protected  JRootPane rootPane
          The single RootPane in the Dialog.
protected  boolean rootPaneCheckingEnabled
          Whether checking is enabled on the RootPane.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JDialog()
           
JDialog(Dialog owner)
          Creates a new non-modal JDialog with no title using the given owner.
JDialog(Dialog owner, boolean modal)
          Creates a new JDialog with no title using the given modal setting and owner.
JDialog(Dialog owner, String title)
          Creates a new non-modal JDialog using the given title and owner.
JDialog(Dialog owner, String title, boolean modal)
          Creates a new JDialog using the given modal settings, title, and owner.
JDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
          Creates a new JDialog using the given modal settings, title, owner and graphics configuration.
JDialog(Frame owner)
          Creates a new non-modal JDialog with no title using the given owner.
JDialog(Frame owner, boolean modal)
          Creates a new JDialog with no title using the given modal setting and owner.
JDialog(Frame owner, String title)
          Creates a new non-modal JDialog using the given title and owner.
JDialog(Frame owner, String title, boolean modal)
          Creates a new JDialog using the given modal settings, title, and owner.
JDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
          Creates a new JDialog using the given modal settings, title, owner and graphics configuration.
 
Method Summary
protected  void addImpl(Component comp, Object constraints, int index)
          This method is called when a component is added to the the JDialog.
protected  JRootPane createRootPane()
          This method creates a new JRootPane.
protected  void dialogInit()
          This method is called to initialize the JDialog.
 AccessibleContext getAccessibleContext()
          DOCUMENT ME!
 Container getContentPane()
          This method returns the ContentPane in the JRootPane.
 int getDefaultCloseOperation()
          This method returns the action taken when the JDialog is closed.
 Component getGlassPane()
          This method returns the GlassPane for this JDialog.
 JMenuBar getJMenuBar()
          This method returns the JMenuBar used in this JDialog.
 JLayeredPane getLayeredPane()
          This method returns the JLayeredPane used with this JDialog.
 Dimension getPreferredSize()
          This method returns the preferred size of the JDialog.
 JRootPane getRootPane()
          This method returns the JRootPane used with this JDialog.
static boolean isDefaultLookAndFeelDecorated()
          This method returns whether JDialogs will have their window decorations provided by the Look and Feel.
protected  boolean isRootPaneCheckingEnabled()
          This method returns whether rootPane checking is enabled.
protected  String paramString()
          This method returns a String describing the JDialog.
protected  void processWindowEvent(WindowEvent e)
          This method handles window events.
 void remove(Component comp)
          This method removes a component from the JDialog.
 void setContentPane(Container contentPane)
          This method sets the ContentPane to use with this JDialog.
 void setDefaultCloseOperation(int operation)
          This method sets the action to take when the JDialog is closed.
static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
          This method sets whether JDialogs will have their window decorations provided by the Look and Feel.
 void setGlassPane(Component glassPane)
          This method sets the GlassPane for this JDialog.
 void setJMenuBar(JMenuBar menubar)
          This method sets the JMenuBar used in this JDialog.
 void setLayeredPane(JLayeredPane layeredPane)
          This method sets the JLayeredPane used in the JDialog.
 void setLayout(LayoutManager manager)
          This method sets the LayoutManager used in the JDialog.
protected  void setRootPane(JRootPane root)
          This method sets the JRootPane used with this JDialog.
protected  void setRootPaneCheckingEnabled(boolean enabled)
          This method sets whether rootPane checking is enabled.
 void update(Graphics g)
          This method simply calls paint and returns.
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getGraphicsConfiguration, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, 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, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

accessibleContext

protected AccessibleContext accessibleContext
DOCUMENT ME!


rootPane

protected JRootPane rootPane
The single RootPane in the Dialog.


rootPaneCheckingEnabled

protected boolean rootPaneCheckingEnabled
Whether checking is enabled on the RootPane.

Constructor Detail

JDialog

public JDialog()

JDialog

public JDialog(Dialog owner)
Creates a new non-modal JDialog with no title using the given owner.

Parameters:
owner - The owner of the JDialog.

JDialog

public JDialog(Dialog owner,
               boolean modal)
Creates a new JDialog with no title using the given modal setting and owner.

Parameters:
owner - The owner of the JDialog.
modal - Whether the JDialog is modal.

JDialog

public JDialog(Dialog owner,
               String title)
Creates a new non-modal JDialog using the given title and owner.

Parameters:
owner - The owner of the JDialog.
title - The title of the JDialog.

JDialog

public JDialog(Dialog owner,
               String title,
               boolean modal)
Creates a new JDialog using the given modal settings, title, and owner.

Parameters:
owner - The owner of the JDialog.
title - The title of the JDialog.
modal - Whether the JDialog is modal.

JDialog

public JDialog(Dialog owner,
               String title,
               boolean modal,
               GraphicsConfiguration gc)
Creates a new JDialog using the given modal settings, title, owner and graphics configuration.

Parameters:
owner - The owner of the JDialog.
title - The title of the JDialog.
modal - Whether the JDialog is modal.
gc - The Graphics Configuration to use.

JDialog

public JDialog(Frame owner)
Creates a new non-modal JDialog with no title using the given owner.

Parameters:
owner - The owner of the JDialog.

JDialog

public JDialog(Frame owner,
               boolean modal)
Creates a new JDialog with no title using the given modal setting and owner.

Parameters:
owner - The owner of the JDialog.
modal - Whether the JDialog is modal.

JDialog

public JDialog(Frame owner,
               String title)
Creates a new non-modal JDialog using the given title and owner.

Parameters:
owner - The owner of the JDialog.
title - The title of the JDialog.

JDialog

public JDialog(Frame owner,
               String title,
               boolean modal)
Creates a new JDialog using the given modal settings, title, and owner.

Parameters:
owner - The owner of the JDialog.
title - The title of the JDialog.
modal - Whether the JDialog is modal.

JDialog

public JDialog(Frame owner,
               String title,
               boolean modal,
               GraphicsConfiguration gc)
Creates a new JDialog using the given modal settings, title, owner and graphics configuration.

Parameters:
owner - The owner of the JDialog.
title - The title of the JDialog.
modal - Whether the JDialog is modal.
gc - The Graphics Configuration to use.
Method Detail

dialogInit

protected void dialogInit()
This method is called to initialize the JDialog. It sets the layout used, the locale, and creates the RootPane.


isDefaultLookAndFeelDecorated

public static boolean isDefaultLookAndFeelDecorated()
This method returns whether JDialogs will have their window decorations provided by the Look and Feel.

Returns:
Whether the window decorations are Look and Feel provided.

setDefaultLookAndFeelDecorated

public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
This method sets whether JDialogs will have their window decorations provided by the Look and Feel.

Parameters:
defaultLookAndFeelDecorated - Whether the window decorations are Look and Feel provided.

getPreferredSize

public Dimension getPreferredSize()
This method returns the preferred size of the JDialog.

Overrides:
getPreferredSize in class Container
Returns:
The preferred size.
See Also:
Component.getMinimumSize(), Component.setPreferredSize(Dimension), LayoutManager

getJMenuBar

public JMenuBar getJMenuBar()
This method returns the JMenuBar used in this JDialog.

Returns:
The JMenuBar in the JDialog.

setJMenuBar

public void setJMenuBar(JMenuBar menubar)
This method sets the JMenuBar used in this JDialog.

Parameters:
menubar - The JMenuBar to use.

setLayout

public void setLayout(LayoutManager manager)
This method sets the LayoutManager used in the JDialog. This method will throw an Error if rootPaneChecking is enabled.

Overrides:
setLayout in class Container
Parameters:
manager - The LayoutManager to use.

setLayeredPane

public void setLayeredPane(JLayeredPane layeredPane)
This method sets the JLayeredPane used in the JDialog. If the given JLayeredPane is null, then this method will throw an Error.

Specified by:
setLayeredPane in interface RootPaneContainer
Parameters:
layeredPane - The JLayeredPane to use.

getLayeredPane

public JLayeredPane getLayeredPane()
This method returns the JLayeredPane used with this JDialog.

Specified by:
getLayeredPane in interface RootPaneContainer
Returns:
The JLayeredPane used with this JDialog.

getRootPane

public JRootPane getRootPane()
This method returns the JRootPane used with this JDialog.

Specified by:
getRootPane in interface RootPaneContainer
Returns:
The JRootPane used with this JDialog.

setRootPane

protected void setRootPane(JRootPane root)
This method sets the JRootPane used with this JDialog.

Parameters:
root - The JRootPane to use.

createRootPane

protected JRootPane createRootPane()
This method creates a new JRootPane.

Returns:
A new JRootPane.

getContentPane

public Container getContentPane()
This method returns the ContentPane in the JRootPane.

Specified by:
getContentPane in interface RootPaneContainer
Returns:
The ContentPane in the JRootPane.

setContentPane

public void setContentPane(Container contentPane)
This method sets the ContentPane to use with this JDialog. If the ContentPane given is null, this method will throw an exception.

Specified by:
setContentPane in interface RootPaneContainer
Parameters:
contentPane - The ContentPane to use with the JDialog.

getGlassPane

public Component getGlassPane()
This method returns the GlassPane for this JDialog.

Specified by:
getGlassPane in interface RootPaneContainer
Returns:
The GlassPane for this JDialog.

setGlassPane

public void setGlassPane(Component glassPane)
This method sets the GlassPane for this JDialog.

Specified by:
setGlassPane in interface RootPaneContainer
Parameters:
glassPane - The GlassPane for this JDialog.

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
This method is called when a component is added to the the JDialog. Calling this method with rootPaneCheckingEnabled will cause an Error to be thrown.

Overrides:
addImpl in class Container
Parameters:
comp - The component to add.
constraints - The constraints.
index - The position of the component.

remove

public void remove(Component comp)
This method removes a component from the JDialog.

Overrides:
remove in class Container
Parameters:
comp - The component to remove.

isRootPaneCheckingEnabled

protected boolean isRootPaneCheckingEnabled()
This method returns whether rootPane checking is enabled.

Returns:
Whether rootPane checking is enabled.

setRootPaneCheckingEnabled

protected void setRootPaneCheckingEnabled(boolean enabled)
This method sets whether rootPane checking is enabled.

Parameters:
enabled - Whether rootPane checking is enabled.

update

public void update(Graphics g)
This method simply calls paint and returns.

Overrides:
update in class Container
Parameters:
g - The Graphics object to paint with.
See Also:
Component.paint(Graphics), Component.repaint()

processWindowEvent

protected void processWindowEvent(WindowEvent e)
This method handles window events. This allows the JDialog to honour its default close operation.

Overrides:
processWindowEvent in class Window
Parameters:
e - The WindowEvent.

setDefaultCloseOperation

public void setDefaultCloseOperation(int operation)
This method sets the action to take when the JDialog is closed.

Parameters:
operation - The action to take.

getDefaultCloseOperation

public int getDefaultCloseOperation()
This method returns the action taken when the JDialog is closed.

Returns:
The action to take.

paramString

protected String paramString()
This method returns a String describing the JDialog.

Overrides:
paramString in class Dialog
Returns:
A String describing the JDialog.

getAccessibleContext

public AccessibleContext getAccessibleContext()
DOCUMENT ME!

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class Dialog
Returns:
DOCUMENT ME!