|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.filechooser.FileFilter
edu.princeton.swing.ExtensionFileFilter
public class ExtensionFileFilter
ExtensionFileFilter extends FileFilter to provide a generalized extension-based file filter.
Constructor Summary | |
---|---|
ExtensionFileFilter()
Creates a new ExtensionFileFilter. |
|
ExtensionFileFilter(String baseDescription)
Creates a new ExtensionFileFilter. |
|
ExtensionFileFilter(String extension,
String baseDescription)
Creates a new ExtensionFileFilter. |
Method Summary | |
---|---|
boolean |
accept(File file)
Extend FileFilter to accept only files with an extension matching one added to the filter. |
void |
addExtension(String extension)
Adds an extension to the list of accepted extensions. |
void |
clearExtensions()
Removes all extensions from the list of accepted extensions. |
String |
getDescription()
Gets a description of this filter. |
String |
getExtension(int index)
Return the extension at a given index. |
int |
getExtensionCount()
Return the number of extensions this filter will accept. |
void |
setBaseDescription(String baseDescription)
Sets the base description of this filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtensionFileFilter()
public ExtensionFileFilter(String baseDescription)
public ExtensionFileFilter(String extension, String baseDescription)
Method Detail |
---|
public boolean accept(File file)
accept
in class FileFilter
public int getExtensionCount()
public String getExtension(int index)
index
- The index of the desired extension. An ArrayIndexOutOfBoundsException will
be thrown if the index is invalid.
public void addExtension(String extension)
extension
- The new extension to accept. A null value will result in a
NullPointerException.public void clearExtensions()
public String getDescription()
getDescription
in class FileFilter
public void setBaseDescription(String baseDescription)
baseDescription
- The base description of this filter, eg. "Web Image Files"
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |