de.saar.basic
Class GenericFileFilter

Object
  extended by FileFilter
      extended by GenericFileFilter
All Implemented Interfaces:
Comparable

public class GenericFileFilter
extends FileFilter
implements Comparable

A FileFilter which can be customised with an arbitrary file type and which generates a standard description do appear in a JFileChooser.

Author:
Alexander Koller
See Also:
JFileChooser, FileFilter

Constructor Summary
GenericFileFilter(String extension, String desc)
          Create a GenericFileFilter accepting the file type described.
 
Method Summary
 boolean accept(File f)
           
 int compareTo(Object o)
           
 String getDescription()
          Returns the description of this file filter, as displayed in the dropdown list.
 String getExtension()
          Returns the filename extension associated with this file filter.
 String getName()
          Returns the name of the file type (e.g., the codec name, not the extension) of this file filter.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericFileFilter

public GenericFileFilter(String extension,
                         String desc)
Create a GenericFileFilter accepting the file type described.

Parameters:
extension - the extension of the file type
desc - a description of the file type
Method Detail

accept

public boolean accept(File f)
Specified by:
accept in class FileFilter
Returns:

getDescription

public String getDescription()
Returns the description of this file filter, as displayed in the dropdown list.

Specified by:
getDescription in class FileFilter
Returns:

getName

public String getName()
Returns the name of the file type (e.g., the codec name, not the extension) of this file filter.

Returns:

getExtension

public String getExtension()
Returns the filename extension associated with this file filter.

Returns:

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable