- java.lang.Object
-
- javax.swing.filechooser.FileFilter
-
- util.ui.ExtensionFileFilter
-
- All Implemented Interfaces:
java.io.FilenameFilter
public class ExtensionFileFilter extends javax.swing.filechooser.FileFilter implements java.io.FilenameFilter
A file filter that allows to specify a set of extension for determining, whether a file should be shown.- Author:
- Til Schneider, www.murfman.de
-
-
Constructor Summary
Constructors Constructor Description ExtensionFileFilter(java.lang.String[] extenstionList, java.lang.String name)
Creates a new instance of ExtensionFileFilter.ExtensionFileFilter(java.lang.String extension, java.lang.String name)
Creates a new instance of ExtensionFileFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(java.io.File file)
Returns whether this given File is accepted by this filter.boolean
accept(java.io.File dir, java.lang.String name)
Returns whether this given File is accepted by this filter.java.lang.String
getDescription()
Gets the localized name of this filter.java.lang.String
getExtension()
java.lang.String
toString()
Gets the localized name of this filter.
-
-
-
Constructor Detail
-
ExtensionFileFilter
public ExtensionFileFilter(java.lang.String extension, java.lang.String name)
Creates a new instance of ExtensionFileFilter.- Parameters:
extension
- The file extension this filter should let pass.name
- The localized name for this filter.
-
ExtensionFileFilter
public ExtensionFileFilter(java.lang.String[] extenstionList, java.lang.String name)
Creates a new instance of ExtensionFileFilter.- Parameters:
extenstionList
- The file extensions this filter should let pass.name
- The localized name for this filter.
-
-
Method Detail
-
toString
public java.lang.String toString()
Gets the localized name of this filter.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the localized name of this filter.
-
accept
public boolean accept(java.io.File file)
Returns whether this given File is accepted by this filter.- Specified by:
accept
in classjavax.swing.filechooser.FileFilter
- Parameters:
file
- The file to check.- Returns:
- whether the specified file is accepted.
-
getDescription
public java.lang.String getDescription()
Gets the localized name of this filter.- Specified by:
getDescription
in classjavax.swing.filechooser.FileFilter
- Returns:
- the localized name of this filter.
-
accept
public boolean accept(java.io.File dir, java.lang.String name)
Returns whether this given File is accepted by this filter.- Specified by:
accept
in interfacejava.io.FilenameFilter
- Parameters:
dir
- The directory of the file to check.name
- The name of the file to check.- Returns:
- whether the specified file is accepted.
-
getExtension
public java.lang.String getExtension()
-
-