Example of how to use Nimbus, swingnimbus

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.