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 (
JDialog, and even
JInternalFrame) contain an instance of another
JRootPane , as their only component, and implement a common
. In this section, we’ll look at
RootPaneContainer, as well as another class
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
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.
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
as the “true” container of child components managed by the container.
This class is discussed later in this chapter.
JRootPane is a special container that extends ...