• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set Look and Feel ?

 
Gary Hill
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Using Netbeans:

I am trying to get a GUI window to look correct on windows XP at the moment it is using "Metal" as its default window.

I have searched on the internet and found code thats supposed to change it but it doesn't work ?

If you could assist me i would be grateful.

Regards

Gary





 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The look and feel should be set before the GUI is shown. Any changes afterwards are not automatically shown. You can force a reload using SwingUtilities.updateComponentTreeUI though. The Component argument and all of its children are then repainted with the new look and feel.
 
Gary Hill
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

Thanks is now working.. and for any one else that reads this here is the working main code.

Regards


Gary



 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Side note: it's a bad idea to "swallow" exceptions like that. What happens if something goes wrong in the creation of your window? You'll be wondering why your application doesn't show, and you won't know why. The least you should do is log the exception (e.g. e.printStackTrace()).
 
Gary Hill
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

Yes thanks for pointing that out.

Regards

Gary
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!