Java Reference
In-Depth Information
■
Note
For the
DesktopManager
methods that accept a
JComponent
argument, the arguments are
usually a
JInternalFrame
or another lightweight Swing component.
When
JInternalFrame
objects are in a
JDesktopPane
, they shouldn't attempt operations
such as iconifying or maximizing themselves. Instead, they should ask the desktop manager of
the desktop pane in which they're installed to perform the operation:
getDesktopPane().getDesktopManager().iconifyFrame(anInternalFrame);
The
DefaultDesktopManager
class provides one such implementation of a
DesktopManager
.
If the default isn't sufficient, a look and feel might provide its own
DesktopManager
implemen-
tation class, as the Windows look and feel does with the
WindowsDesktopManager
. You can also
define your own manager, but this usually isn't necessary.
Summary
In this chapter, you explored the
JRootPane
class and how implementers of the
RootPaneContainer
interface rely on a
JRootPane
for internal component management. You also learned how in Swing
you work with the
JRootPane
of a
JFrame
,
JDialog
,
JWindow
,
JApplet
, or
JInternalFrame
class.
The root pane can then layer components with the help of a
JLayeredPane
in such a way that
tooltip text and pop-up menus will always appear above their associated components.
The
JInternalFrame
can also reside within a desktop environment, in which a
JDesktopPane
and
DesktopManager
manage how and where the internal frames act and appear. You can also
respond to internal frame events by associating
InternalFrameListener
implementations with
a
JInternalFrame
.
In Chapter 9, you'll examine the specialized pop-up components within the Swing libraries:
JColorChooser
,
JFileChooser
,
JOptionPane
, and
ProgressMonitor
.