visad.util
Class ExtensionFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by visad.util.ExtensionFileFilter
All Implemented Interfaces:
FileFilter, Comparable

public class ExtensionFileFilter
extends FileFilter
implements FileFilter, Comparable

A file filter based on file extensions, for use with a JFileChooser.


Constructor Summary
ExtensionFileFilter(String[] extensions, String description)
          Constructs a new filter that accepts the given extensions.
ExtensionFileFilter(String extension, String description)
          Constructs a new filter that accepts the given extension.
 
Method Summary
 boolean accept(File f)
          Accepts files with the proper extensions.
 int compareTo(Object o)
          Compares two FileFilter objects alphanumerically.
 String getDescription()
          Gets the filter's description.
 String getExtension()
          Gets the filter's first valid extension.
 String[] getExtensions()
          Gets the filter's valid extensions.
 String toString()
          Gets a string representation of this file filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(String extension,
                           String description)
Constructs a new filter that accepts the given extension.


ExtensionFileFilter

public ExtensionFileFilter(String[] extensions,
                           String description)
Constructs a new filter that accepts the given extensions.

Method Detail

getExtension

public String getExtension()
Gets the filter's first valid extension.


getExtensions

public String[] getExtensions()
Gets the filter's valid extensions.


accept

public boolean accept(File f)
Accepts files with the proper extensions.

Specified by:
accept in interface FileFilter
Specified by:
accept in class FileFilter

getDescription

public String getDescription()
Gets the filter's description.

Specified by:
getDescription in class FileFilter

toString

public String toString()
Gets a string representation of this file filter.

Overrides:
toString in class Object

compareTo

public int compareTo(Object o)
Compares two FileFilter objects alphanumerically.

Specified by:
compareTo in interface Comparable