util
Class FileChooserFilter
java.lang.Object
|
+--javax.swing.filechooser.FileFilter
|
+--util.FileChooserFilter
- public class FileChooserFilter
- extends javax.swing.filechooser.FileFilter
This class provides a simple javax.swing.filechooser.FileFilter
implementation that accepts files based on their extension, or
if they are a directory (to allow traversal of the filesystem).
multiple permissible extensions can be specified.
- Author:
- Graeme Bell
Constructor Summary |
FileChooserFilter(java.lang.Object[] extensions,
java.lang.String description)
This method instantiates a new FileChooser filter. |
FileChooserFilter(java.lang.String[] extensions,
java.lang.String description)
This method instantiates a new FileChooser filter. |
Method Summary |
boolean |
accept(java.io.File f)
This implements javax.swing.filechooser.FileFilter functionality. |
java.lang.String |
getDescription()
This is used to provide the JFileChooser with information
on what the accept mapping represents. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileChooserFilter
public FileChooserFilter(java.lang.String[] extensions,
java.lang.String description)
- This method instantiates a new FileChooser filter.
- Parameters:
extensions
- a String[] of extensions to map againstdescription
- a String describing what these extensions
represent.
FileChooserFilter
public FileChooserFilter(java.lang.Object[] extensions,
java.lang.String description)
- This method instantiates a new FileChooser filter.
- Parameters:
extensions
- a Object[] of extensions to map againstdescription
- a String describing what these extensions
represent.
accept
public boolean accept(java.io.File f)
- This implements javax.swing.filechooser.FileFilter functionality.
It accepts files based on their extension and also if they
are directories.
- Overrides:
accept
in class javax.swing.filechooser.FileFilter
- Parameters:
f
- the file to be checked for having a suitable extension
or for being a directory.- Returns:
- true if file matches extension/is a directory. false otherwise.
getDescription
public java.lang.String getDescription()
- This is used to provide the JFileChooser with information
on what the accept mapping represents.
- Overrides:
getDescription
in class javax.swing.filechooser.FileFilter
- Returns:
- a String describing this FileFilters mapping.