a few of its containers are completely managed by Java so that they can have
ponents that might not be available on every windowing system; for example,
tables and trees.
The standard class library organizes Swing's many types into the javax.swing
packageandvarioussubpackages.Forexample,the javax.swing.table subpack-
age stores types that support Swing's table component.
This section introduces you to Swing by presenting its architecture and sampling
An Extended Architecture
By extending AWT, Swing shares AWT's architecture. However, Swing goes beyond
what AWT has to offer by providing an extended architecture. This architecture is
ers, UI delegates, and pluggable look and feels.
New Heavyweight Containers
The javax.swing package includes JDialog , JFrame , and JWindow container
classes that extend their java.awt.Dialog , java.awt.Frame , and
java.awt.Window counterparts. These heavyweight containers manage their con-
tained lightweight components (such as javax.swing.JButton ) and containers
(such as javax.swing.JPanel ).
JDialog , JFrame , JWindow ,andtwootherSwingcontainersuse panes (special-
root, layered, content, and glass panes:
• The root pane contains the layered pane and the glass pane. It's implemented
via the javax.swing.JRootPane class.
• The layered pane containstheapplication'smenubarandthecontentpane.It's
implemented via the javax.swing.JLayeredPane class.
• The content pane isa Container subclassinstancethatstorestheGUI'snon-
• The glass pane is a transparent Component instance that covers the layered
Figure 7-11 reveals a container's pane-based architecture.