Java Reference
In-Depth Information
Figure 4-15 shows the test driver program results.
Figure 4-15. The new OvalPanel component
Note By default, JPanel components are opaque. This differs from JComponent , whose opacity
property setting by default is false . A false setting for opacity means the component is transparent.
Customizing a JPanel Look and Feel
The available set of UIResource -related properties for a JPanel is shown in Table 4-16. For the
JPanel component, there are five different properties. These settings may have an effect on the
components within the panel.
Table 4-16. JPanel UIResource Elements
Property String
Object Type
Panel.background
Color
Panel.border
Border
Panel.font
Font
Panel.foreground
Color
PanelUI
String
Summary
In this chapter, you explored the root of all Swing components: the JComponent class. From
there, you looked at some of the common elements of all components, such as tooltips, as well
as specific components such as JLabel . You also learned how to put glyphs (nonverbal images)
on components with the help of the Icon interface and the ImageIcon class, and the GrayFilter
image filter for disabled icons.
 
Search WWH ::




Custom Search