I'm trying to generate a JFileChooser
that has the Windows look-and-feel. I couldn't find a method to change it, so I created a base class that extends JFileChooser
that changes the UI with the following code:
public FileChooser(){
this(null);
}
public FileChooser(String path){
super(path);
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) { System.err.println("Error: " + e.getMessage()); }
Then, in another class, I call
FileChooser chooser = new FileChooser(fileName);
int val = chooser.showOpenDialog(null);
but the dialog box that comes up has the Java look and feel. Any thoughts on how to change this? Is there a method of the JFileChooser class that I can use instead of this extended class?
Thank you!