Minimize to a Mini-Frame #40
Chapter 5, Windows, Dialogs, and Frames
When the user clicks the triangle at the bottom left, the More Info text area
appears, as seen in Figure 5-10.
H A C K
Minimize to a Mini-Frame Hack #40
When you want your program to have a smaller window but still be on the
screen, try building a mini-mode.
Since the advent of iTunes, it seems that all consumer-oriented applications
must have meticulous interfaces that can dynamically adjust themselves.
Gone are the days of simply minimizing an application. Now your program
must have a small version rather than (or in addition to) hiding when mini-
mized. The smaller version contains limited controls but can fit nicely at the
bottom of the screen. This hack shows how to create a dynamic frame that
can switch properly between sizes for a more modern-looking interface.
JScrollPane scroller =
new JScrollPane (area,
MoreInfoPanel mip = new MoreInfoPanel (grabbedContent, scroller);
// dialog blocks on setVisible (JOptionPane makes it modal)
Figure 5-10. The Warning dialog after opening the MoreInfoPanel
Example 5-8. A spin-open dialog using a MoreInfoPanel (continued)