kawigi.util
Class GenericFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by kawigi.util.GenericFileFilter

public class GenericFileFilter
extends javax.swing.filechooser.FileFilter

Good All-purpose configurable file filter.


Constructor Summary
GenericFileFilter(java.lang.String name)
          Creates a new file filter with the given description.
GenericFileFilter(java.lang.String name, java.lang.String extension)
          Creates a new file filter with the given description and single file extension.
 
Method Summary
 boolean accept(java.io.File f)
          Returns true if the file should be shown with this filter.
 void addExtension(java.lang.String ext)
          Adds a file extension accepted by this filter.
 java.lang.String getDescription()
          Returns the description of this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericFileFilter

public GenericFileFilter(java.lang.String name)
Creates a new file filter with the given description. File extensions should be added subsequently using addExtention.


GenericFileFilter

public GenericFileFilter(java.lang.String name,
                         java.lang.String extension)
Creates a new file filter with the given description and single file extension. Subsequent file extensions can be added using addExtension.

Method Detail

addExtension

public void addExtension(java.lang.String ext)
Adds a file extension accepted by this filter.


accept

public boolean accept(java.io.File f)
Returns true if the file should be shown with this filter. It will be accepted if it is either a folder or a file with one of the extensions specified for this file filter. The extensions are not case sensitive.

Specified by:
accept in class javax.swing.filechooser.FileFilter

getDescription

public java.lang.String getDescription()
Returns the description of this filter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter