简体   繁体   中英

Different look and feel of java application from the look and feel of Operating System

I've been asked to modify a java desktop application (I've never worked on java desktop application).

I have been gaven the project that I opened with Netbeans 8.0.2 . Something weird happens.

If I launch the app from Netbeans (after doing " clean and build ") with right click on the project - > run I get this look and feel:

在此输入图像描述

If I launch the app from command line with java -jar C:\\Users\\...\\NetBeansProjects\\Clean\\appaName.jar I get this look and feel (that is the correct one, since it is the look and feel of my OS, windows 10):

在此输入图像描述

As you can see from the pics below, on Netbeans the Runtime Platform and JRE seem to be correclty set.

在此输入图像描述 在此输入图像描述 Does anybody know why? Be patience, I've never worked on desktop aplication.

Thank you

Initialize the look & feel to the System one. (Though I like "Nimbus" more.)

This should best be done in the beginning.

public static void main(String[] args) {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    ...
}

Look in the NetBeans generated code for a main ; as look&feel code might well be generated too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM