public class ExtensionFileFilter
extends javax.swing.filechooser.FileFilter
implements java.io.FilenameFilter, java.io.Serializable
Constructor and Description |
---|
ExtensionFileFilter(java.lang.String[] extensions,
java.lang.String description)
Creates an ExtensionFileFilter that accepts files that have any of the
extensions contained in the supplied array.
|
ExtensionFileFilter(java.lang.String extension,
java.lang.String description)
Creates the ExtensionFileFilter
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File file)
Returns true if the supplied file should be accepted (i.e.: if it has the
required extension or is a directory).
|
boolean |
accept(java.io.File dir,
java.lang.String name)
Returns true if the file in the given directory with the given name should
be accepted.
|
java.lang.String |
getDescription()
Gets the description of accepted files.
|
java.lang.String[] |
getExtensions()
Returns a copy of the acceptable extensions.
|
public ExtensionFileFilter(java.lang.String extension, java.lang.String description)
extension
- the extension of accepted files.description
- a text description of accepted files.public ExtensionFileFilter(java.lang.String[] extensions, java.lang.String description)
extensions
- an array of acceptable file extensions (as Strings).description
- a text description of accepted files.public java.lang.String getDescription()
getDescription
in class javax.swing.filechooser.FileFilter
public java.lang.String[] getExtensions()
public boolean accept(java.io.File file)
accept
in class javax.swing.filechooser.FileFilter
file
- the file of interest.public boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
dir
- the directory where the file resides.name
- the name of the file.