Question

Just wanna ask as I keep wondering and search for on the Mr.Google but nothing helps me.

I developed a java desktop application using Netbeans, it works fine until I try to run it. When I run it by clicking run file on the GUI class it shows Nimbus look and feel.

But when I run through my main class ( calling the setVisible ) it shows metal look and feel.

Can I know what actually went wrong? I don't touch anything for the generated code. Is there anybody who have the same problem and have solve it?

Was it helpful?

Solution

Make sure you are setting the look and feel before it is visible (or else you'll be forced to update the component tree for every visible component). Before you call setVisible(true) on your JFrame, the following line should be present:

UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top