How to use Java Swing Nimbus

Source: Internet
Author: User

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. Ten years ago, the Metal interface was an attractive and elegant choice compared with other common interfaces at that time. The updated Ocean topic in Java SE 5 makes Metal a viable option, but it is imperative to modify the appearance of the Swing cross-platform interface. 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 in the main function. Remember to add the code in the first place before entering other code: try {UIManager. setLookAndFeel ("com. sun. java. swing. plaf. nimbus. nimbusLookAndFeel ");} catch (Exception e) {e. printStackTrace ();} You can also specify-Dswing on the command line. defaultlaf = com. sun. java. swing. pl a f. nim bus. nim changes Nimbus to 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. 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.