0
votes

I have separately changed the default look and feel code of my Java project build using Netbeans look and feel setting code in each Jframe.

It runs perfectly when I run Jframes separately.

But When I run complete project.It always shows the default Nimbus look and feel, even though I have changed look and feel of JFrames seperately.

Can anyone suggest me to apply windows Look and feel to complete project?

Thank you very much. I am a beginner for programming.

1
"even though I have changed the JFrames seperately." See The Use of Multiple JFrames, Good/Bad Practice? BTW - you forgot to ask a question.Andrew Thompson

1 Answers

1
votes

I have resolved the problem. It was an easy task,

Just put this code in your Main Class of the project

    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Windows".equals(info.getName())) {       javax.swing.UIManager.setLookAndFeel(info.getClassName());
}
}

**REMEMBER TO SURROUND THE BLOCK WITH TRY-CATCH

I have checked this even this works through many look and Feels, If you need to maintain through out the project runtime in GUI