org.montsuqi.util
Class ExtensionFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.montsuqi.util.ExtensionFileFilter

public class ExtensionFileFilter
extends javax.swing.filechooser.FileFilter

A FileFilter that filters by file name extension.

This filter accepts files whose names end with the specified extension. All directories (with any name) are also accepted.


Constructor Summary
ExtensionFileFilter(java.lang.String extension, java.lang.String description)
          Constructs a ExtensionFileFilter that filters by given extension.
 
Method Summary
 boolean accept(java.io.File f)
          Returns true when the given file is a directory or its name ends with the extension.
 java.lang.String getDescription()
          Returns textual description of this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String extension,
                           java.lang.String description)

Constructs a ExtensionFileFilter that filters by given extension.

Parameters:
extension - extension which is accepted.
description - descriptive text that explains this filter.
Method Detail

accept

public boolean accept(java.io.File f)

Returns true when the given file is a directory or its name ends with the extension. False otherwise.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
f - a File to test.
Returns:
true when the file is acceptable by this filter, false otherwise.

getDescription

public java.lang.String getDescription()

Returns textual description of this filter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
Returns:
a descriptive text.