Are there any predefined file filters for a JFileChooser?

John Zukowski

Apart from the accept all filter, until Java 6, there were no predefined filters. Java 6 introduces the FileNameExtensionFilter, allowing you to define one or more types of files for the user to select.

FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
JFileChooser fileChooser = ...;