Java Reference
In-Depth Information
For the Metal look and feel (and Ocean theme), getSupportsWindowDecorations() reports
true . The other system-provided look and feel types report false . Figure 8-2 demonstrates
what a frame looks like with the window adornments provided by the Metal look and feel.
Figure 8-2. Metal window adornments for a JFrame
The source to produce Figure 8-2 is shown in Listing 8-1.
Listing 8-1. Setting the Window Decoration Style
import java.awt.*;
import javax.swing.*;
public class AdornSample {
public static void main(final String args[]) {
Runnable runner = new Runnable() {
public void run() {
JFrame frame = new JFrame("Adornment Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
frame.setSize(300, 100);
frame.setVisible(true);
}
};
EventQueue.invokeLater(runner);
}
}
Customizing a JRootPane Look and Feel
Table 8-2 shows the 12 UIResource -related properties for a JRootPane . Most of these settings have
to do with the default border to use when configuring the window decoration style.
Table 8-2. JRootPane UIResource Elements
Property String
Object Type
RootPane.actionMap
ActionMap
RootPane.ancestorInputMap
InputMap
RootPane.colorChooserDialogBorder
Border
 
Search WWH ::




Custom Search