This discussion is archived
1 Reply Latest reply: Apr 25, 2013 5:37 AM by thomas.behr RSS

Using FileFilter problems with JFileChooser in JDK 1.7.0

J1286756 Newbie
Currently Being Moderated
I have an implementation of the FileFilter class used with JFileChooser and it worked for jdk versions upto 1.6.30 by correctly filtering the file types when the JFileChooser was invoked. I then upgraded to jdk1.7.0.10 and suddenly the JFileChooser instead defaults to "All Files" and doesn't filter by file type as it used to. Code fragment below
        JFileChooser chooser = new JFileChooser(aFile.getAbsolutePath());
        chooser.setAcceptAllFileFilterUsed(true);
        chooser.addChoosableFileFilter(fileFilter);
Is there something else that needs to change.
I know there is a java implementation of the FileFilter class - FileNameExtensionFilter - but I really would like to know what is causing this change in behaviour between the jdk versions.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points