dLife Home Page

dlife.sys
Class SubClassFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by dlife.sys.SubClassFileFilter

public class SubClassFileFilter
extends FileFilter

This class filters files in the JFileChooser such that only concrete sub-classes of a specified super-class will be able to be selected.

Version:
Jun 22, 2009
Author:
Grant Braught, Dickinson College

Constructor Summary
SubClassFileFilter(String superClass)
          Construct a new SubClassFileFilter for the specified super class.
 
Method Summary
 boolean accept(File f)
          Return true if the file f is a subclass of the super class that was specified when this FileFilter was constructed and false otherwise.
 String getDescription()
          Get the description of this FileFilter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubClassFileFilter

public SubClassFileFilter(String superClass)
Construct a new SubClassFileFilter for the specified super class. The super class is specified using its full binary name (e.g. java.lang.String)

Parameters:
superClass - the super class for the classes that can be selected.
Method Detail

accept

public boolean accept(File f)
Return true if the file f is a subclass of the super class that was specified when this FileFilter was constructed and false otherwise.

Specified by:
accept in class FileFilter
Parameters:
f - the File to check.
Returns:
true if f is a subclass of the desired super class.

getDescription

public String getDescription()
Get the description of this FileFilter.

Specified by:
getDescription in class FileFilter
Returns:
extends superClass where superClass was specified at construction.

dLife Home Page