论坛首页 Java企业应用论坛

Nimbus Look and Feel

浏览 3090 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2008-11-29   最后修改:2008-11-29
imbus Look and Feel
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.
[img] src="http://java.sun.com/developer/technicalArticles/javase/java6u10/images/meta.gif" width="654" border="0" height="400"[/img]

Figure 3: SwingSet3 in Metal

[img] src="http://java.sun.com/developer/technicalArticles/javase/java6u10/images/nimbus.gif" width="654" border="0" height="400"[/img]

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 more information on usage of Nimbus, please see 6u10 Release Notes.

   发表时间:2009-05-18  
写什么呢?
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics