beowulf.filefilters
Class ExtensionFileFilter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended bybeowulf.filefilters.ExtensionFileFilter

public class ExtensionFileFilter
extends FileFilter

This class represents a filter that accepts a file based on its extension. The extension of the file is compared to the extension given to the filter on creation. The period character, ".", must begin the extension.

Version:
1.0 11/7/2003
Author:
Andy Scukanec (ags at cs dot cornell dot edu)

Field Summary
protected  String extension
          The extension that all acceptable files must have.
 
Constructor Summary
ExtensionFileFilter(String newExtension)
          Creates an instance of this object with the indicated extension.
 
Method Summary
 boolean accept(File f)
          This filter will accept a file f if and only if the last four characters of its name are the indicated extension.
 String getDescription()
          This method returns a description of what files are accepted by this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extension

protected String extension
The extension that all acceptable files must have.

Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(String newExtension)
Creates an instance of this object with the indicated extension. The separating period must be the first character of the string.

Method Detail

accept

public boolean accept(File f)
This filter will accept a file f if and only if the last four characters of its name are the indicated extension. Directories are also accepted.

Parameters:
f - The file to accept or reject
Returns:
True if and only if the file is accepted.

getDescription

public String getDescription()
This method returns a description of what files are accepted by this class.

Returns:
A description string.