Home » openjdk-7 » javax » swing » filechooser » [javadoc | source]
public final class: FileNameExtensionFilter [javadoc | source]
An implementation of {@code 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 {@code FileNameExtensionFilter} that will show {@code jpg} files:

FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
JFileChooser fileChooser = ...;
 public FileNameExtensionFilter(String description,
    String extensions) 
    Creates a {@code FileNameExtensionFilter} with the specified description and file name extensions. The returned {@code FileNameExtensionFilter} will accept all directories and any file with a file name extension contained in {@code extensions}.
    description - textual description for the filter, may be {@code null}
    extensions - the accepted file name extensions
    IllegalArgumentException - if extensions is {@code null}, empty, contains {@code null}, or contains an empty string
    Also see:
Method from javax.swing.filechooser.FileNameExtensionFilter Summary:
accept,   getDescription,   getExtensions,   toString
Methods from javax.swing.filechooser.FileFilter:
accept,   getDescription
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.filechooser.FileNameExtensionFilter Detail:
 public boolean accept(File f) 
    Tests the specified file, returning true if the file is accepted, false otherwise. True is returned if the extension matches one of the file name extensions of this {@code FileFilter}, or the file is a directory.
 public String getDescription() 
    The description of this filter. For example: "JPG and GIF Images."
 public String[] getExtensions() 
    Returns the set of file name extensions files are tested against.
 public String toString() 
    Returns a string representation of the {@code FileNameExtensionFilter}. This method is intended to be used for debugging purposes, and the content and format of the returned string may vary between implementations.