Getting java applications to look native on windows - how?

try {
    // Set the Look and Feel of the application to the operating
    // system's look and feel.
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException e) {
}
catch (InstantiationException e) {
}
catch (IllegalAccessException e) {
}
catch (UnsupportedLookAndFeelException e) {
}

That should set the Look and Feel to the system look and feel. You would do this before any of your GUI code. For example, in your main method.

If you want to learn more about Look and Feels, I would check out the Java Tutorial on them, as suggested by carwash.


Everyone else has posted Swing things, so I'm going to play Devil's advocate and mention SWT.

SWT is a widget toolkit produced by the Eclipse foundation. It is a thin wrapper over the system's native GUI... for Windows, OSX, and various flavors of *nix (Linux, AIX, BSDs?, etc...).

This is the opposite route that Sun's JFC/Swing took, which draws its own components.