In Java, setting a look and feel by calling the UIManager‘s setLookAndFeel() method will result in all components’ look and feel to be the same. But there are such UI classes not part of the JDK’s documentation that cater to such needs.
Take the JFileChooser for example. Instead of a metal look and feel, I wanted it to be windows like. While not in the official documentation, the UI class com.sun.java.swing.plaf.windows.WindowsFileChooserUI can be used to make a JFileChooser‘s look and theme the same as that in Windows. To use this UI class, do the following:
JFileChooser jfc = new JFileChooser();
WindowsFileChooserUI wui = new WindowsFileChooserUI(jfc);
At first, I created a class that inherits from JFileChooser and called its protected setUI() method there and instantiating the WindowsFileChooserUI class. The result was that the folders’ icons are blank and I get NullPointerException errors. The code above, with the installUI() method the critical part did the trick.