• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting actual native look and feel, instead of swing laf  RSS feed

 
Daniel Pride
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Netbeans Matisse GUI builder (JDK 6) and it allows you to preview under different look and feels, obviously I prefer native system look and feel as I think swing looks pretty horrid. When I compile and run the program I get the same swing style look when I'd rather have the native look.

I tried setting the LAF manually using a snippet of code I found online



But it's still giving me the swig style rather than the actual native windows (which is the system I am developing on).
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code should work - if those statements occur before the GUI is shown.

As for why it's not - I don't know exactly - is the GUI already visible? There are a ton of empty "catch" clauses also that might show you if an exception was occurring that was preventing the native L&F from being applied.

Check out Sun's page on setting the Look and Feel.

The code fragment above is shown there, as well as how to apply a look and feel after components are visible (if that is the issue) - under "Changing the Look and Feel After Startup".
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At what point are you calling this code? Before or after the GUI has already been built?

If the GUI has already been built you can update your UI using SwingUtilities.updateComponentTreeUI(Component)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!