weka.gui
Class ExtensionFileFilter
java.lang.Object
|
+--javax.swing.filechooser.FileFilter
|
+--weka.gui.ExtensionFileFilter
- All Implemented Interfaces:
- java.io.FilenameFilter
- public class ExtensionFileFilter
- extends javax.swing.filechooser.FileFilter
- implements java.io.FilenameFilter
Provides a file filter for FileChoosers that accepts or rejects files
based on their extension. Compatible with both java.io.FilenameFilter and
javax.swing.filechooser.FileFilter (why there are two I have no idea).
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
Field Summary |
protected java.lang.String |
m_Description
The text description of the types of files accepted |
protected java.lang.String |
m_Extension
The filename extension of accepted files |
Constructor Summary |
ExtensionFileFilter(java.lang.String extension,
java.lang.String description)
Creates the ExtensionFileFilter |
Method Summary |
boolean |
accept(java.io.File file)
Returns true if the supplied file should be accepted (i.e. |
boolean |
accept(java.io.File dir,
java.lang.String name)
Returns true if the file in the given directory with the given name
should be accepted. |
java.lang.String |
getDescription()
Gets the description of accepted files. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_Description
protected java.lang.String m_Description
- The text description of the types of files accepted
m_Extension
protected java.lang.String m_Extension
- The filename extension of accepted files
ExtensionFileFilter
public ExtensionFileFilter(java.lang.String extension,
java.lang.String description)
- Creates the ExtensionFileFilter
- Parameters:
extension
- the extension of accepted files.description
- a text description of accepted files.
getDescription
public java.lang.String getDescription()
- Gets the description of accepted files.
- Overrides:
getDescription
in class javax.swing.filechooser.FileFilter
- Returns:
- the description.
accept
public boolean accept(java.io.File file)
- Returns true if the supplied file should be accepted (i.e. if it
has the required extension or is a directory).
- Overrides:
accept
in class javax.swing.filechooser.FileFilter
- Parameters:
file
- the file of interest.- Returns:
- true if the file is accepted by the filter.
accept
public boolean accept(java.io.File dir,
java.lang.String name)
- Returns true if the file in the given directory with the given name
should be accepted.
- Specified by:
accept
in interface java.io.FilenameFilter
- Parameters:
dir
- the directory where the file resides.name
- the name of the file.- Returns:
- true if the file is accepted.