Updated Lesson: Setting the Look and Feel in Swing
By user12610255 on Dec 22, 2006
In the Swing Tutorial, the How to Set the Look and Feel page has been updated to reflect the L&Fs that are currently available for a particular operating system.
Two commonly used L&Fs are:
CrossPlatformLookAndFeel—this is the "Java L&F" (also called "Metal") that looks the same on all platforms. It is part of the Java API (
javax.swing.plaf.metal) and is the default that will be used if you do nothing in your code to set a different L&F.
SystemLookAndFeel—here, the application uses the L&F that is native to the system it is running on. The System L&F is determined at runtime, where the application asks the system to return the name of the appropriate L&F.
Code examples show how your program can set the L&F. An extended example allows you to select alternative L&Fs and see the results.
New Information in the Updated LessonThere are two new additions to this lesson:
- A discussion of Themes.
- The SwingSet2 Demonstration Program
Themes were introduced as a way of easily changing the colors and fonts of the cross-platform Java (Metal) Look and Feel.
SwingSet2 demonstration program allows you to select
different L&Fs from a menu (provided that they will
run on your system) so you can see what they look like. You can also choose different
Themes from a
menu when you are running the cross-platform
Java (Metal) L&F. You can launch this demonstration program directly from the lesson using Java Web Start.
-- Tom Risser