Subpages: 1. JDesktopPane and JInternalFrame
2. Internalizable/Externalizable frames
3. Cascading and outline dragging mode
4. An X windows style desktop environment
5. A networked multi-user desktop using sockets
16.2 Internalizable/externalizable frames
Most often in Java applets and applications we do not work in full-screen mode. Because of this JDesktopPanes can often become very cluttered. We may, at some point, want to have the option of bringing an internal frame outside of the desktop. We call this externalizing a frame, for lack of a given name. (Please do not confuse the use of "externalizable" here with Java's Externalizable interface, an extension of the Serializable interface.) Superfically, externalizing is the process of transforming a JInternalFrame into a JFrame.
Now consider an application in which a maximized JFrame is used. When this maximized frame gains the focus it hides all other existing frames and dialogs behind it. In situations where we need to switch back and forth between frames or dialogs this can be quite annoying. In order to accomodate for this problem we can think of bringing dialogs and frames inside the maximized frame to a JDesktopPane. We call this internalizing a frame. Superficially, internalizing is the process of transforming a JFrame into a JInternalFrame.
Figure 16.2 Internalizable/externalizable frames
Although there is no real transformation that occurs, this is what appears to happen from the user's perspective. Internalizing and externalizing is actually achieved by moving the contentPane from a JFrame to a JInternalFrame and vice versa, respectively. The process is simple to implement:
For externalization do the following:
1. Hide a JInternalFrame with setVisible(false).
2. Replace the contentPane of a hidden JFrame with that of the hidden JInternalFrame.
3. Reveal the JFrame using setVisible(true).
Internalization is just the opposite.