Getting java applications to look native on windows - how?

java, scala, user-interface, windows

Solution

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.

Problem

Is it possible to use Java to create apps that look native on Windows? I don't care if the solution is portable or not, because I only plan to target windows users. I am using Scala if that matters. Sorry for the lack of details, but I have never used Java before so I'm not even sure if this is possible.

Original source