Nimbus is the name of a look-and-feel designed by Sun for the Java Desktop System; it's implemented as a GTK theme in the latest Solaris 11 pre-release builds. In 2007, Sun's Swing Team and Ben Galbraith jointly launched an open-source project to implement the Nimbus specifications as a Swing look-and-feel. Jasper Potts, an experienced Swing developer with notable experience created high-quality Swing look-and-feels, was recently hired by Sun and provided the initial code for the project, including a baseline Nimbus Synth implementation of a large number of components.
Currently, the project is using Synth to implement Nimbus. This dovetails nicely with the Swing Team's goal to further refine Synth, but the primary reason for this decision is that using Synth does make many tasks easier. While Java 5 compatibility is a goal, this project will first implement Nimbus on Java 6 and will address Java 5 later, either through a Java 5 update or a stand-alone compatibility library.
There is a webstartable demo of SwingSet running Nimbus on Swing Labs.
STEP 1:
Download Nimbus binary from https://nimbus.dev.java.net/servlets/ProjectDocumentList?folderID=7067&expandFolder=7067&folderID=0. In this tutorial I am using nimbus-2008_02_10.jar.
STEP 2:
Rigt click on your current project which you want to use Nimbus, choose Properties in NetBeans. Select Libraries and add nimbus-2008_02_10.jar to compile and runtime respectively.
STEP 3:
Add code below:
try {
UIManager.setLookAndFeel("org.jdesktop.swingx.plaf.nimbus.NimbusLookAndFeel");
} catch (ClassNotFoundException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
}
It seems that Nimbus do not support Unicode at this time....
没有评论:
发表评论