Chapter 26. Look & Feel

Way back in Chapter 1, we introduced the concept of Swing’s pluggable look-and-feel (PLAF ) architecture. In this chapter, we’ll get into a variety of topics related to PLAF. The chapter includes:

  • An overview of how the Swing component classes work together with the UI-delegate classes.

  • A detailed explanation of the various PLAF-related classes in the javax.swing package, as well as some of the important classes and interfaces from javax.swing.plaf.

  • An explanation of how PLAF fits into JFC’s accessibility framework using the MultiLookAndFeel.

  • Detailed discussions of strategies for customizing the look-and-feel of your applications using the following techniques:

    • Modification of specific component properties

    • Modification of resource defaults

    • Use of themes in the Metal L&F

    • Use of customized client properties in the Metal look-and-feel (L&F)

    • Replacement of specific UI delegates

    • Creation of a new L&F from scratch

This chapter contains a lot of technical detail. You can do a lot with Swing’s PLAF architecture without understanding everything we cover here. If you’re interested in customizing the look-and-feel of your applications, but don’t mind if there are a few things that don’t quite make sense, you can skim the next few sections and jump right into Section 26.4. If you want to understand exactly how everything works, read on.

How Does It Work?

As you probably already know, each instance of a given Swing component uses a UI delegate to render the component using the ...

Get Java Swing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.