Key Look-and-Feel Classes and Interfaces
In this section, we’ll take an in-depth look at several key classes and interfaces that make up the Swing PLAF design. Figure 26-4 shows the relationships between the classes (and interfaces) we will examine in this section.

Figure 26-4. High-level L&F 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 L&F.
-
UIDefaults An L&F is responsible for defining a set of default properties.
UIDefaultsis aHashtablesubclass that holds these properties. The properties includeUIClassIDtoComponentUIsubclass mappings (e.g.,"TreeUI"toMetalTreeUI) as well as lower-level defaults, such as colors and fonts.-
UIDefaults.ActiveValueandUIDefaults.LazyValue These inner interfaces of
UIDefaultsenable some optimizations for resource values.-
UIResource This is an empty interface (like
SerializableorCloneable) used to tag property values. It allows values defined by the L&F to be distinguished from values set by the user, as described in Section 26.3.5 later in this chapter.-
UIManager If you’ve ever changed the L&F of a Swing program at runtime, you’re probably already familiar with this class.
UIManageris responsible ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access