Skip to Main Content
Java Swing, 2nd Edition
book

Java Swing, 2nd Edition

by Dave Wood, Robert Eckstein, Marc Loy, James Elliott, Brian Cole
November 2002
Intermediate to advanced content levelIntermediate to advanced
1278 pages
38h 26m
English
O'Reilly Media, Inc.
Content preview from Java Swing, 2nd Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Threads, 3rd Edition

Java Threads, 3rd Edition

Scott Oaks, Henry Wong

Publisher Resources

ISBN: 0596004087Errata PageSupplemental Content