Example of how to use Nimbus, swingnimbus
Java Swing interface appearance, made its debut in Java 6 Update 10.
When Swing's ancient Metal interface was first launched, its main aesthetic competition came from the Windows 95 interface. In the graphic user field 10 years ago
Metal is an attractive and elegant choice compared with other common interfaces at the time.
The updated Ocean topic in Java SE 5 helps Metal become a viable option, but it is imperative to modify the appearance of the Swing cross-platform interface.
Urgent.
Go to the Nimbus interface to see the new modern appearance Based on synthesis. Nimbus provides a perfect interface for its applications.
Nimbus uses Java 2D vector instead of static bitmap, so it is very small (only 56KB !), Any resolution is available.
Due to compatibility, Metal still uses the default Swing interface appearance. However, it is no longer necessary to replace the update program with the Nimbus interface. You only need to add the following code to the main function. Remember to add the code first before entering other code:
Try {
UIManager. setLookAndFeel ("com. sun. java. swing. plaf. nimbus. NimbusLookAndFeel ");
} Catch (Exception e ){
E. printStackTrace ();
}
You can also specify-Dswing. defaultlaf = com. sun. java. swing. pl a f. nim bus. Nim on the command line to make Nimbus the default Interface appearance.
One way to set attributes permanently is to add the code: swing. defaultlaf = com. sun. java. swing. plaf. nimbus. nimbusLookAndFeel if swing. properties file does not exist. You must create one.
After adding
Before adding