public class DefaultFileFilter
extends javax.swing.filechooser.FileFilter
JFileChooser
.Modifier and Type | Class and Description |
---|---|
static class |
DefaultFileFilter.EditorFileFilter
Utility file filter to accept editor files, namely .xml and .xml.gz
extensions.
|
static class |
DefaultFileFilter.ImageFileFilter
Utility file filter to accept all image formats supported by image io.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
desc
Description of accepted files.
|
protected java.lang.String |
ext
Extension of accepted files.
|
Constructor and Description |
---|
DefaultFileFilter(java.lang.String extension,
java.lang.String description)
Constructs a new filter for the specified extension and descpription.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File file)
Returns true if
file is a directory or ends with
ext . |
java.lang.String |
getDescription()
Returns the description for accepted files.
|
java.lang.String |
getExtension()
Returns the extension for accepted files.
|
void |
setExtension(java.lang.String extension)
Sets the extension for accepted files.
|
protected java.lang.String ext
protected java.lang.String desc
public DefaultFileFilter(java.lang.String extension, java.lang.String description)
extension
- The extension to accept files with.description
- The description of the file format.public boolean accept(java.io.File file)
file
is a directory or ends with
ext
.accept
in class javax.swing.filechooser.FileFilter
file
- The file to be checked.public java.lang.String getDescription()
getDescription
in class javax.swing.filechooser.FileFilter
public java.lang.String getExtension()
public void setExtension(java.lang.String extension)
extension
- The extension to set.