Class ExtensionFileFilter

java.lang.Object
thinletcommons.ExtensionFileFilter
All Implemented Interfaces:
FileFilter

public class ExtensionFileFilter extends Object implements FileFilter
A file filter for FileChooser that accepts files based on file name endings (extensions).

Note that the file filter is case sensitive. That is a file filter instance created with new ExtensionFileFilter("xml", "XML files") accepts file.xml but not FILE.XML.

Author:
Dirk Moebius
  • Constructor Details

    • ExtensionFileFilter

      public ExtensionFileFilter(String extension, String description)
      Create a new ExceptionFileFilter.
      Parameters:
      extension - the extention, for example "xml", "jpg", etc.
      description - the description.
  • Method Details

    • accept

      public boolean accept(File file)
      Whether the given file is accepted by this filter.
      Specified by:
      accept in interface FileFilter
    • getDescription

      public String getDescription()
      A human readable description of this file filter.
      Specified by:
      getDescription in interface FileFilter