O'Reilly logo

Java Swing by Dave Wood, Marc Loy, Robert Eckstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Key L&F Classes and Interfaces

In this section, we’ll take an in-depth look at several of the key classes and interfaces that make up the Swing pluggable look-and-feel design. Figure 26.3 shows the relationships between the classes (and interfaces) we’re going to examine in this section.

High-level look-and-feel class diagram

Figure 26-3. High-level look-and-feel class diagram

Before we look at the details of each of these classes, we’ll quickly describe the role each one plays:

LookAndFeel

The abstract base class from which all the different L&Fs extend. It defines a number of static convenience methods, as well as some abstract methods required by every look-and-feel.

UIDefaults

One of the things an L&F is responsible for is defining a set of default properties. UIDefaults is a Hashtable subclass that holds these properties. The properties include UIClassID to ComponentUI subclasses mappings (e.g., "TreeUI" to MetalTreeUI) as well as lower-level defaults, such as colors and fonts.

UIDefaults. ActiveValue and UIDefaults.LazyValue

These inner classes of UIDefaults enable some optimizations for resource values.

UIResource

This is an empty interface (like Serializable or Cloneable) used to tag property values. It allows values defined by the L&F to be distinguished from values set by the user.

UIManager

If you’ve ever changed the L&F of a Swing program, you’re probably already familiar with this class. UIManager is responsible ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required