Java >
Guidelines Home Page >  Java Look and Feel Design Guidelines
Part IV: Backmatter
D: Switching Look and Feel Designs
  Previous Next Contents/Index/Search

D: Switching Look and Feel Designs

As a developer, you might want to provide users with the ability to switch the appearance of components within applications. This appendix contains some information about the pitfalls of letting users change the look and feel, along with guidelines on how to present the choice to users when necessary. The ability to switch look and feel designs is intended for use as a design- time feature rather than a runtime feature.

Pitfalls of User-Controlled Switching

The Swing components and the pluggable look and feel mechanism enable users to select the look and feel of an application. This choice is misleading, however, since a significant portion of the feel of an application is its general design, layout, and terminology.

It is usually unwise to give end users the ability to swap look and feel designs while working in your application. Switching look and feel designs in this way primarily swaps the appearance of the components. The layout and vocabulary used are programmed in and do not change. For instance, swapping look and feel designs does not change the titles of the menus.

The JFC has no special provisions that enable users to select a look and feel on the fly. The look and feel switching seen in many demos shows some of the power of the JFC, but on-the-fly look and feel switching was not a core design goal. As a result, there is no guarantee that user interfaces designed properly in one look and feel can migrate cleanly to another look and feel.

Successful user-controlled switching requires that the infrastructure behind the components have an understanding of each platform's design, layout, and nomenclature. In practice, there is more to a Microsoft Windows, Mac OS, or CDE application than the appearance and behavior of individual components.

  Do not enable user-controlled look and feel switching in your application without careful consideration.

The following figure illustrates a file chooser built in the CDE style, using Swing components.

Figure 201   CDE File Chooser


CDE File Chooser

The next figure shows what a component-level switch from the CDE to the Macintosh look and feel might look like.

Figure 202   Macintosh File Chooser (Simple Look and Feel Switch)


Macintosh File Chooser (Simple Switch)

The component-level look and feel switch has not created a Macintosh file chooser. A higher level of understanding of the design principles for the Macintosh platform would be needed for this transformation to occur correctly. The following figure shows what a correct transformation to the Macintosh file chooser might look like.

Figure 203   Macintosh File Chooser (Following Macintosh Style)


Macintosh File Chooser (Following Mac Style)

While the JFC does not provide a general solution to complete user-controlled look and feel switching, a specific application could ensure the correct layout and nomenclature for each look and feel that it supports. However, this would likely entail a significant amount of work.

If you are developing an application with more than a single target platform, consider using a cross-platform look and feel design, such as the Java look and feel.

Java Look and Feel Design Guidelines, second edition.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.
Previous Next Contents/Index/Search
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Java 8 banner (182)