Pluggable Look & Feel
Home ] Up ] What are Events? ] The Java Event Model ] Buttons ] [ Pluggable Look & Feel ] Windows ] Mousing ] Keyboard Input ] Menus ] Separating Form from Function ] Event Multicasting ]

 

Example
Metal & Themes

 

In JDK 1.2 and beyond, it's possible, using Swing, to change the way things appear and behave.  This is commonly known as "Look and Feel", or LAF, or L&F.  Each platform has its own specific look and feel, and many, including Microsoft Windows and Apple Macintosh, are protected by patents, etc.

JavaSoft came up with their own, platform-neutral L&F, originally called Metal, but now simply called the Java L&F, which is available on all platforms.  They have also implemented the Microsoft Windows LAF, the Motif LAF, and the Macintosh LAF.  However, because of legal issues, the Microsoft Windows and Macintosh LAFs are only available on their respective platforms.

By default, Java programs display with the Java L&F.  You can change this by setting the swing.defaultlaf property to the fully-qualified name of the desired L&F class.

You can also specify the desired L&F at run time.  One approach is to set the L&F at the beginning of your Java program.  Another is to change the L&F completely dynamically.

 

This page was last modified on 02 October, 2007