be.ugent.caagt.swirl.actions
Class ExtensionFileFilter
java.lang.Object
javax.swing.filechooser.FileFilter
be.ugent.caagt.swirl.actions.ExtensionFileFilter
public class ExtensionFileFilter
- extends javax.swing.filechooser.FileFilter
Implements a Swing file filter that filters files on extensions.
Constructor Summary |
ExtensionFileFilter(java.lang.String extension,
java.lang.String description)
Creates a file filter which only allows files with the given extension. |
Method Summary |
boolean |
accept(java.io.File file)
|
java.io.File |
ensureExtension(java.io.File original)
Returns the given file with the extension of this filter added,
if the file has no extension. |
java.lang.String |
getDescription()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExtensionFileFilter
public ExtensionFileFilter(java.lang.String extension,
java.lang.String description)
- Creates a file filter which only allows files with the given extension.
(Case is ignored when doing the comparison.)
- Parameters:
extension
- Extension which is to be alloweddescription
- Description for this filter
accept
public boolean accept(java.io.File file)
- Specified by:
accept
in class javax.swing.filechooser.FileFilter
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in class javax.swing.filechooser.FileFilter
ensureExtension
public java.io.File ensureExtension(java.io.File original)
- Returns the given file with the extension of this filter added,
if the file has no extension.