Class FilenameExtensionFilter

java.lang.Object
javax.swing.filechooser.FileFilter
com.compomics.util.io.file.FilenameExtensionFilter
All Implemented Interfaces:
FilenameFilter

public class FilenameExtensionFilter
extends FileFilter
implements FilenameFilter
This class will implement a FilenameFilter that filters on the extension of files.
Author:
Lennart Martens
  • Constructor Details

    • FilenameExtensionFilter

      public FilenameExtensionFilter()
      Empty default constructor
    • FilenameExtensionFilter

      public FilenameExtensionFilter​(String aExtension)
      This constructor takes an extension to filter on. It doesn't care about a leading dot, so specifying '.class' is identical to 'class'.
      Parameters:
      aExtension - String with the extension to filter. Note that '.class' is identical to 'class'.
    • FilenameExtensionFilter

      public FilenameExtensionFilter​(String aExtension, String aDescription)
      This constructor takes an extension to filter on. It doesn't care about a leading dot, so specifying '.class' is identical to 'class'.
      Parameters:
      aExtension - String with the extension to filter. Note that '.class' is identical to 'class'.
      aDescription - String with the description for the FileFilter. Can be null in which case the description will be an empty String.
  • Method Details

    • accept

      public boolean accept​(File dir, String name)
      Tests if a specified file should be included in a file list.
      Specified by:
      accept in interface FilenameFilter
      Parameters:
      dir - the directory in which the file was found.
      name - the name of the file.
      Returns:
      true if and only if the name should be included in the file list; false otherwise.
    • accept

      public boolean accept​(File f)
      Specified by:
      accept in class FileFilter
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class FileFilter