0

I made a simple Jframe with its child components in netbeans, when i run the application it shows it in NIMBUZZ lookandfeel as shown below:-

This is what i have

But I want it to be always shown in WINDOWS lookandfeel as shown below :-

This is what i want

How am I suppose to do that??

Community
  • 1
  • 1
Sukupa91
  • 133
  • 3
  • 9

2 Answers2

2

Before creating your first window call this code:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

note that this will work as expected only under windows where this is the system LAF

bennyl
  • 2,886
  • 2
  • 29
  • 43
  • @Sushantp606, would you care to say what was the problem? – bennyl Mar 22 '14 at 12:50
  • Actually the frame is fine , i changed lookandfeel in Main method of Jframe class in netbeans . When i run it , the window means frame appears but in nimbuzz lookandfeel , intead of that i want widows look and feel . The thing you mentioned in your answer is an better option but its showing error. So where exactly i shall implement this line of code? – Sukupa91 Mar 22 '14 at 12:55
  • @Sushantp606 you need to call it in the main method before any invockation of Swing related code - also note that there are several exceptions to catch you can just log them or try a different LAF if an exception is thrown – bennyl Mar 22 '14 at 12:58
  • thanks , Last thing if i run this app on linux , will it work?? – Sukupa91 Mar 22 '14 at 13:04
  • It will work but the LAF will not be the one for windows as windows LAF only available on windows OS – bennyl Mar 22 '14 at 13:06
  • So it will automatically use GTK+ or motif , based on OS theme? – Sukupa91 Mar 22 '14 at 13:07
2

You maybe looking for setWindowDecorationStyle(), although some L&Fs may not support the feature. A complete example is cited here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045