Module java.desktop

Class FileNameExtensionFilter

java.lang.Object
javax.swing.filechooser.FileFilter
javax.swing.filechooser.FileNameExtensionFilter

public final class FileNameExtensionFilter extends FileFilter
An implementation of FileFilter that filters using a specified set of extensions. The extension for a file is the portion of the file name after the last ".". Files whose name does not contain a "." have no file name extension. File name extension comparisons are case insensitive.

The following example creates a FileNameExtensionFilter that will show jpg files:

 FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
 JFileChooser fileChooser = ...;
 fileChooser.addChoosableFileFilter(filter);
 
Since:
1.6
See Also: