Skip to main content

Native look and feel doesn't seem to stick on Windows XP with JDK 6

1 reply [Last post]
bertszoghy
Offline
Joined: 2008-01-24
Points: 0

Hello,

I'm building SWING apps on Netbeans 6, JDK 6, Windows XP. The preview shows my form the way I like, but when I compile, it reverts to another look and feel.

I have to manually add code to get what I want, i.e.:
public void run()
{
try
{
String nativeLF = javax.swing.UIManager.getSystemLookAndFeelClassName();
javax.swing.UIManager.setLookAndFeel(nativeLF);
new MyApp().setVisible(true);
}
catch (InstantiationException e)
{
}
catch (ClassNotFoundException e)
{
}
catch (IllegalAccessException e)
{
}
catch(java.util.concurrent.RejectedExecutionException r)
{
// known bug in SDK 6, see http://forums.java.net/jive/thread.jspa?messageID=237592&#237592
}
catch (Exception e)
{
}
}

How do you do this through the GUI ?

Thanks,
Bert

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mbien
Offline
Joined: 2007-04-29
Points: 0

AFAIK there is no graphical editor for changing the L&F of your application (except for the preview).

you should setup this kind of things before you set any gui component to visible. It often won't make sense to put that code into the gui component because this is a VM wide setup (you have in most cases more than one form).