| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public final class FileNameExtensionFilter extends FileFilter
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 = ...; fileChooser.addChoosableFileFilter(filter);
Constructor Summary | |
---|---|
FileNameExtensionFilter(String description, String[] extensions) Creates a with the specified description and file name extensions. |
Method Summary | |
---|---|
boolean |
Tests the specified file, returning true if the file is accepted, false otherwise. |
String |
The description of this filter. |
String[] |
Returns the set of file name extensions files are tested against. |
String |
toString() Returns a string representation of the . |
Methods inherited from class javax.swing.filechooser.FileFilter |
---|
accept, getDescription |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileNameExtensionFilter(String description, String[] extensions)
description
- textual description for the filter, may be
{@code null}extensions
- the accepted file name extensionsMethod Detail |
---|
public boolean accept(File f)
accept
in class FileFilter
f
- the {@code File} to testpublic String getDescription()
getDescription
in class FileFilter
public String[] getExtensions()
public String toString()
toString
in class Object
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |