edu.princeton.swing
public class ExtensionFileFilter extends javax.swing.filechooser.FileFilter
Constructor and Description |
---|
ExtensionFileFilter()
Creates a new ExtensionFileFilter.
|
ExtensionFileFilter(java.lang.String baseDescription)
Creates a new ExtensionFileFilter.
|
ExtensionFileFilter(java.lang.String extension,
java.lang.String baseDescription)
Creates a new ExtensionFileFilter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File file)
Extend FileFilter to accept only files with an extension matching one added to the filter.
|
void |
addExtension(java.lang.String extension)
Adds an extension to the list of accepted extensions.
|
void |
clearExtensions()
Removes all extensions from the list of accepted extensions.
|
java.lang.String |
getDescription()
Gets a description of this filter.
|
java.lang.String |
getExtension(int index)
Return the extension at a given index.
|
int |
getExtensionCount()
Return the number of extensions this filter will accept.
|
void |
setBaseDescription(java.lang.String baseDescription)
Sets the base description of this filter.
|
public ExtensionFileFilter()
public ExtensionFileFilter(java.lang.String baseDescription)
public ExtensionFileFilter(java.lang.String extension, java.lang.String baseDescription)
public boolean accept(java.io.File file)
accept
in class javax.swing.filechooser.FileFilter
public int getExtensionCount()
public java.lang.String getExtension(int index)
index
- The index of the desired extension. An ArrayIndexOutOfBoundsException will
be thrown if the index is invalid.public void addExtension(java.lang.String extension)
extension
- The new extension to accept. A null value will result in a
NullPointerException.public void clearExtensions()
public java.lang.String getDescription()
getDescription
in class javax.swing.filechooser.FileFilter
public void setBaseDescription(java.lang.String baseDescription)
baseDescription
- The base description of this filter, eg. "Web Image Files"