For the rest of this chapter,
we’ll look at some basic containers (
RootPaneContainer and use
JRootPane. First, we’ll take a quick look at
a simple interface called
a simple interface containing only constants. It is implemented by
The constants defined in
possible behaviors in response to a window being closed. These values
are shown in Table 8.6.
Table 8-6. WindowConstants Constants
Dispose window when closed.
Do nothing when closed.
Hide window when closed.
In the next section, we’ll look at a strategy for exiting the application in response to a frame being closed.
The most common Swing container for Java
applications is the
a top-level window with a title, border, and other platform-specific
adornments (e.g., minimize, maximize, and close buttons). Because it
JRootPane as its only child, working with a
JFrame is slightly different than working with an
Frame. An empty
shown in Figure 8.9.
Figure 8-9. JFrame
The primary difference is that calls to
add() must be replaced with calls to ...