O'Reilly logo

Java Swing, 2nd Edition by Brian Cole, James Elliott, Marc Loy, Robert Eckstein, Dave Wood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The JDialog Class

JDialog is the Swing version of its superclass, java.awt.Dialog. It provides the same key features described in Chapter 8 [2] in the discussion of JWindow, JFrame, and JApplet: it uses a JRootPane as its container, and it provides default window-closing behavior. Since JDialog extends java.awt.Dialog, it has a heavyweight peer and is managed by the native windowing system. Figure 10-1 shows how JDialog fits into the class hierarchy.

JDialog class diagram

Figure 10-1. JDialog class diagram

Properties

JDialog defines the properties and default values listed in Table 10-1. The content-Pane, glassPane, JMenuBar, and layeredPane properties are taken from rootPane, which is set to a new JRootPane by the constructor.

Table 10-1. JDialog properties

Property

Data type

get

is

set

Default value

accessibleContext o

AccessibleContext

·

  

JDialog.AccessibleJDialog( )

contentPane o

Container

·

 

·

From rootPane

defaultCloseOperation

int

·

 

·

HIDE_ON_CLOSE

defaultLookAndFeelDecorated s, 1.4

boolean

 

·

·

Depends on L&F, often false

glassPane o

Component

·

 

·

From rootPane

JMenuBar o

JMenuBar

·

 

·

null

layeredPane o

JLayeredPane

·

 

·

From rootPane

layout o

LayoutManager

·

 

·

BorderLayout

modal*

boolean

 

·

·

false

parent*

Container

·

  

SwingUtilities.get-SharedOwnerFrame( )

rootPane

JRootPane

·

  

JRootPane

title*

String

·

 

·

""

1.4since 1.4, ooverridden, sstatic

*Inherited from Dialog; can be set in JDialog ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required