Mac OS X and the Default Look-and-Feel

On most platforms, unless the user or application has explicitly specified otherwise, Swing uses the Metal cross-platform L&F, and developers have likely become accustomed to this. With the advent of Mac OS X (which includes a tightly integrated Java environment that tracks Sun’s latest releases), things change slightly. Mac users have strong expectations about the appearance and behavior of their applications, and Apple intends Java to be a first-class development environment on its OS. Because of this, the Mac L&F is the default under Mac OS X. This L&F allows Java applications to appear and behave like other Macintosh applications. This makes them more likely to be familiar to and adopted by Mac users.

As long as developers have made good use of Java’s layout managers to account for differences in rendering between different machines, their applications translate to this new environment well. Unfortunately, not all applications have been designed in this way, and it is sometimes felt that the burden of testing under multiple different L&Fs is too difficult. Although you can use the mechanisms described later in this chapter to force your application to use a particular L&F (like the always available Metal), you should avoid taking this step lightly; it takes choices away from your users and definitely reduces the likelihood of the application’s acceptance on highly consistent platforms like the Macintosh. If, despite this, you feel such ...

Get Java Swing, 2nd Edition 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.