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 Root Pane

Now that we’ve seen the simplest example of a Swing container, we’ll move on to something a bit more powerful. Most of the other Swing containers (JFrame, JApplet, JWindow, JDialog, and even JInternalFrame) contain an instance of another class, JRootPane , as their only component, and implement a common interface, RootPaneContainer . In this section, we’ll look at JRootPane and RootPaneContainer, as well as another class JRootPane uses, JLayeredPane .

Before jumping into the descriptions of these classes, let’s take a look at how the classes and interfaces that make up the Swing root containers fit together. Figure 8-2 shows that JApplet, JFrame, JDialog, and JWindow do not extend JComponent as the other Swing components do. Instead, they extend their AWT counterparts, serving as top-level user interface windows. This implies that these components (unlike the lightweight Swing components) have native AWT peer objects.

Swing “root” container class diagram

Figure 8-2. Swing “root” container class diagram

Notice that these Swing containers (as well as JInternalFrame) implement a common interface, RootPaneContainer . This interface gives access to the JRootPane’s properties. Furthermore, each of the five containers uses a JRootPane as the “true” container of child components managed by the container. This class is discussed later in this chapter.

The JRootPane Class

JRootPane is a special container that extends ...

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