javax.swing

Class JDialog

public class JDialog extends Dialog implements Accessible, WindowConstants, RootPaneContainer

A dialog window. This is an extension of {@link java.awt.Dialog} that provides support for the Swing architecture. Most importantly it contains a {@link 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.
Nested Class Summary
protected classJDialog.AccessibleJDialog
Provides accessibility support for JDialogs.
Field Summary
protected AccessibleContextaccessibleContext
DOCUMENT ME!
protected JRootPanerootPane
The single RootPane in the Dialog.
protected booleanrootPaneCheckingEnabled
Whether checking is enabled on the RootPane.
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 voidaddImpl(Component comp, Object constraints, int index)
This method is called when a component is added to the the JDialog.
protected JRootPanecreateRootPane()
This method creates a new JRootPane.
protected voiddialogInit()
This method is called to initialize the JDialog.
AccessibleContextgetAccessibleContext()
DOCUMENT ME!
ContainergetContentPane()
This method returns the ContentPane in the JRootPane.
intgetDefaultCloseOperation()
This method returns the action taken when the JDialog is closed.
ComponentgetGlassPane()
This method returns the GlassPane for this JDialog.
JMenuBargetJMenuBar()
This method returns the JMenuBar used in this JDialog.
JLayeredPanegetLayeredPane()
This method returns the JLayeredPane used with this JDialog.
DimensiongetPreferredSize()
This method returns the preferred size of the JDialog.
JRootPanegetRootPane()
This method returns the JRootPane used with this JDialog.
static booleanisDefaultLookAndFeelDecorated()
This method returns whether JDialogs will have their window decorations provided by the Look and Feel.
protected booleanisRootPaneCheckingEnabled()
This method returns whether rootPane checking is enabled.
protected StringparamString()
This method returns a String describing the JDialog.
protected voidprocessWindowEvent(WindowEvent e)
This method handles window events.
voidremove(Component comp)
This method removes a component from the JDialog.
voidsetContentPane(Container contentPane)
This method sets the ContentPane to use with this JDialog.
voidsetDefaultCloseOperation(int operation)
This method sets the action to take when the JDialog is closed.
static voidsetDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
This method sets whether JDialogs will have their window decorations provided by the Look and Feel.
voidsetGlassPane(Component glassPane)
This method sets the GlassPane for this JDialog.
voidsetJMenuBar(JMenuBar menubar)
This method sets the JMenuBar used in this JDialog.
voidsetLayeredPane(JLayeredPane layeredPane)
This method sets the JLayeredPane used in the JDialog.
voidsetLayout(LayoutManager manager)
This method sets the LayoutManager used in the JDialog.
protected voidsetRootPane(JRootPane root)
This method sets the JRootPane used with this JDialog.
protected voidsetRootPaneCheckingEnabled(boolean enabled)
This method sets whether rootPane checking is enabled.
voidupdate(Graphics g)
This method simply calls paint and returns.

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.

UNKNOWN: Should be false to comply with J2SE 5.0

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

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.

Parameters: comp The component to add. constraints The constraints. index The position of the component.

createRootPane

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

Returns: A new JRootPane.

dialogInit

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

getAccessibleContext

public AccessibleContext getAccessibleContext()
DOCUMENT ME!

Returns: DOCUMENT ME!

getContentPane

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

Returns: The ContentPane in the JRootPane.

getDefaultCloseOperation

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

Returns: The action to take.

getGlassPane

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

Returns: The GlassPane for this JDialog.

getJMenuBar

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

Returns: The JMenuBar in the JDialog.

getLayeredPane

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

Returns: The JLayeredPane used with this JDialog.

getPreferredSize

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

Returns: The preferred size.

getRootPane

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

Returns: The JRootPane used with this JDialog.

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.

isRootPaneCheckingEnabled

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

Returns: Whether rootPane checking is enabled.

paramString

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

Returns: A String describing the JDialog.

processWindowEvent

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

Parameters: e The WindowEvent.

remove

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

Parameters: comp The component to remove.

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.

Parameters: contentPane The ContentPane to use with the JDialog.

setDefaultCloseOperation

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

Parameters: operation The action to take.

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.

setGlassPane

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

Parameters: glassPane The GlassPane for this JDialog.

setJMenuBar

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

Parameters: menubar The JMenuBar 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.

Parameters: layeredPane The JLayeredPane 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.

Parameters: manager The LayoutManager to use.

setRootPane

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

Parameters: root The JRootPane to use.

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.

Parameters: g The Graphics object to paint with.