Desktops
At this point, you might be thinking that there’s nothing
more that Swing could possibly do, but it just keeps getting better. If
you’ve ever wished that you could have windows within windows in Java,
Swing makes it possible with JDesktopPane and JInternalFrame. Figure 18-10 shows how this appears.
You get a lot of behavior for free from JInternalFrame. Internal
frames can be moved by clicking and dragging the titlebar. They can be
resized by clicking and dragging on the window’s borders. Internal frames
can be iconified, which means reducing them to a small icon representation
on the desktop. Internal frames may also be made to fit the entire size of
the desktop (maximized). To you, the programmer, the internal frame is
just a kind of special container. You can put your application’s data
inside an internal frame just as with any other type of container.

Figure 18-10. Using internal frames on a JDesktopPane
The following brief example shows how to create the windows shown in Figure 18-10:
//file: Desktop.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.border.*;publicclassDesktop{publicstaticvoidmain(String[]args){JFrameframe=newJFrame("Desktop");JDesktopPanedesktop=newJDesktopPane();for(inti=0;i<5;i++){JInternalFrameinternal=newJInternalFrame("Frame "+i,true,true,true,true);internal.setSize ...