Nimbus Look and Feel in Java SE 6 Update 10 Beta

By Ethan Nicholas


When the venerable Metal look and feel for Swing first debuted, its main aesthetic competition was the Windows 95 interface. Given the state of graphical user interfaces a decade ago, Metal was an attractive and elegant alternative to the other common interfaces of the time.

The updated Ocean theme in Java SE 5 helped to keep Metal a viable choice up to the present day, but it's time for Swing's cross-platform look and feel to get an overhaul.

Enter the Nimbus Look and Feel. A brand new, modern look and feel based on Synth, Nimbus provides a polished look to applications which choose to use it. And because Nimbus is drawn entirely using Java 2D vector graphics, rather than static bitmaps, it's tiny (only 56KB!) and can be rendered at arbitrary resolutions.

SwingSet3 in Metal
Figure 3: SwingSet3 in Metal
 
SwingSet3 in Nimbus
Figure 4: SwingSet3 in Nimbus
 

For compatibility reasons, Metal is still the default Swing look and feel, but updating applications to use Nimbus couldn't be simpler. It only takes a single line of code:

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

You can also force Nimbus to be the default look and feel by specifying -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel. on the command line. A more permanent way to set the property is to add

swing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

to the file <JAVA_HOME>/lib/swing.properties. You will have to create the swing.properties file if it does not already exist.

For further reading about Nimbus, take a look at the Nimbus early access page.

Comments:

java is evergreen

Posted by sunil on May 14, 2008 at 01:35 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

John O'Conner

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today