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
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.