Java Swing is very beautiful. Nimbus example of the use of appearance _java

Source: Internet
Author: User
Tags java se

One of the skins of the Java Swing interface that was first unveiled in Java 6 Update 10.
When Swing's old metal interface looks first released, its main aesthetic competition comes from the Windows 95 interface. In the graphical user community ten years ago
Surface conditions, the Metal interface is an attractive and elegant choice compared to other ordinary interfaces of the time.
The updated Ocean theme in Java SE 5 helps Metal become a viable option today, but it's also a matter of modifying Swing across the platform interface
The urgency.
Entering the appearance of the Nimbus interface, you can see a new modern look based on synthesis. Nimbus provides a perfect interface for its applications.
And Nimbus completely uses Java 2D vector graphics instead of static bitmaps, so very small (only 56kb!) can provide any resolution.
For compatibility reasons, Metal still uses the default Swing interface appearance. But the update needed to change the appearance of the Nimbus interface is simple. Just add the following code to the main function, remember to add it first, then fill in the 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 on the command line. Nim makes Nimbus the default interface appearance.
One way to permanently set properties is to add code: Swing.defaultlaf=com.sun.java.swing.plaf.nimbus.nimbuslookandfeel If swing.properties This file does not exist, You must create one.

The following figure is added

The following figure is 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.