Java Reference
In-Depth Information
In addition to the many configurable properties in Table 8-12, with the Metal look and
feel, you can designate an internal frame to be a “palette” by using a special client property,
JInternalFrame.isPalette . When set to Boolean.TRUE , this internal frame will have a slightly
different appearance from the others and a shorter title bar, as shown in Figure 8-6.
0ALETTE
Figure 8-6. A JInternalFrame palette with other frames
If you also add an internal frame to the PALETTE_LAYER of the desktop, the frame will always
appear on top of all the other frames (as noted in Figure 8-6):
JInternalFrame palette = new JInternalFrame("Palette", true, false, true, false);
palette.setBounds(150, 0, 100, 100);
palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
desktop.add(palette, JDesktopPane.PALETTE_LAYER);
The complete source for creating the program in Figure 8-6 appears in Listing 8-6 later in
this chapter.
Note If the current look and feel is something other than Metal, the palette layer will still be honored, but
its appearance won't be quite as distinctive.
Changing the JDesktopIcon
The JInternalFrame relies on an inner class, JDesktopIcon , to provide a UI delegate for the
iconified view of the JInternalFrame . The class is merely a specialized JComponent for providing
this capability, not a specialized Icon implementation, as the name might imply. In fact, the
JDesktopIcon class comments say that the class is temporary, so you shouldn't try to customize
it directly. (Of course, the class has been around for some time now.)
If you do want to customize the JDesktopIcon , you can change some of the UIResource -
related properties. Table 8-13 lists the eight UIResource -related properties for the JDesktopIcon
component.
 
Search WWH ::




Custom Search