|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.filechooser.FileFilter
com.taco.swinger.filechooser.ExtensionFileFilter
public class ExtensionFileFilter
A file filter that accepts only files with names that end with one of an approved list of extensions. Its description can be set, or a default one will be generated if necessary.
Field Summary | |
---|---|
protected boolean |
_acceptDirectories
If true, accept directories. |
protected int |
_cachedHashCode
The hash code for this filter, lazily created and cached. |
protected java.lang.String |
_description
The description of the filter, lazily created and cached if not set explicitly. |
protected boolean |
_descriptionExplicitlySet
True if the description was set with a non-null value by the user. |
protected java.lang.String[] |
_extensions
An array of extensions to match. |
Constructor Summary | |
---|---|
ExtensionFileFilter()
Create a new instance that accepts no extensions and but accepts directories. |
|
ExtensionFileFilter(java.lang.String[] extensions)
Construct a new instance that accepts files whose name ends with any of the extensions in the argument array, case insensitively. |
|
ExtensionFileFilter(java.lang.String[] extensions,
boolean acceptDirectories)
Construct a new instance that accepts files whose name ends with any of the extensions in the argument array, case insensitively. |
|
ExtensionFileFilter(java.lang.String[] extensions,
java.lang.String description,
boolean acceptDirectories)
Construct a new instance that accepts files whose name ends with any of the extensions in the argument array, case insensitively. |
Method Summary | |
---|---|
boolean |
accept(java.io.File file)
|
boolean |
equals(java.lang.Object obj)
This implementation is sensitive to the order of the extensions. |
boolean |
getAcceptDirectories()
Return true if this instance accepts directories. |
java.lang.String |
getDescription()
If the description has been set to a non-null value, return it. |
java.lang.String[] |
getExtensions()
Return a copy of the accepted extension array. |
int |
hashCode()
|
void |
setAcceptDirectories(boolean accept)
Set whether or not this instance accepts directories. |
void |
setDescription(java.lang.String description)
Set the description. |
void |
setExtensions(java.lang.String[] extensions)
Set the extension array to the argument, which is NOT copied. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String[] _extensions
protected boolean _acceptDirectories
protected java.lang.String _description
protected boolean _descriptionExplicitlySet
protected int _cachedHashCode
Constructor Detail |
---|
public ExtensionFileFilter()
public ExtensionFileFilter(java.lang.String[] extensions)
Construct a new instance that accepts files whose name ends with any of the extensions in the argument array, case insensitively. For efficiency reasons, each of the extensions should contain the '.' character before the prefix, and should only contain lower case letters. The argument array will be copied by reference only, so if changes might be made, a clone of the array should be used.
Directories will not be accepted and a default description will be generated if necessary.
public ExtensionFileFilter(java.lang.String[] extensions, boolean acceptDirectories)
Construct a new instance that accepts files whose name ends with any of the extensions in the argument array, case insensitively. For efficiency reasons, each of the extensions should contain the '.' character before the prefix, and should only contain lower case letters. The argument array will be copied by reference only, so if changes might be made, a clone of the array should be used.
If acceptDirectories
is true, the filter will also
accept directories.
A default description will be generated if necessary.
public ExtensionFileFilter(java.lang.String[] extensions, java.lang.String description, boolean acceptDirectories)
Construct a new instance that accepts files whose name ends with any of the extensions in the argument array, case insensitively. For efficiency reasons, each of the extensions should contain the '.' character before the prefix, and should only contain lower case letters. The argument array will be copied by reference only, so if changes might be made, a clone of the array should be used.
If acceptDirectories
is true
, the filter
will also accept directories.
If description
is non-null, it will be used as the
filter description. Otherwise, a default description will be generated
if necessary.
Method Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean accept(java.io.File file)
accept
in class javax.swing.filechooser.FileFilter
public java.lang.String[] getExtensions()
public void setExtensions(java.lang.String[] extensions)
public boolean getAcceptDirectories()
public void setAcceptDirectories(boolean accept)
public java.lang.String getDescription()
If the description has been set to a non-null value, return it. Otherwise, return a string in the format:
Files matching (*.ext, *.yuk)
getDescription
in class javax.swing.filechooser.FileFilter
public void setDescription(java.lang.String description)
null
, compute a
description based on the extension array.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |