X

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.

Join the discussion

Comments ( 1 )
  • sunil Wednesday, May 14, 2008

    java is evergreen


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services