Package org.jfree.ui

Class FilesystemFilter

All Implemented Interfaces:
FilenameFilter

public class FilesystemFilter extends FileFilter implements FilenameFilter
A filesystem filter.
  • Field Details

    • fileext

      private String[] fileext
      The file extension, which should be accepted.
    • descr

      private String descr
      The filter description.
    • accDirs

      private boolean accDirs
      A flag indicating whether to accept directories.
  • Constructor Details

    • FilesystemFilter

      public FilesystemFilter(String fileext, String descr)
      Creates a new filter.
      Parameters:
      fileext - the file extension.
      descr - the description.
    • FilesystemFilter

      public FilesystemFilter(String fileext, String descr, boolean accDirs)
      Creates a new filter.
      Parameters:
      fileext - the file extension.
      descr - the description.
      accDirs - accept directories?
    • FilesystemFilter

      public FilesystemFilter(String[] fileext, String descr, boolean accDirs)
      Creates a new filter.
      Parameters:
      fileext - the file extension.
      descr - the description.
      accDirs - accept directories?
      Throws:
      NullPointerException - if the file extensions are null.
  • Method Details

    • accept

      public boolean accept(File dir, String name)
      Returns true if the file is accepted, and false otherwise.
      Specified by:
      accept in interface FilenameFilter
      Parameters:
      dir - the directory.
      name - the file name.
      Returns:
      A boolean.
    • accept

      public boolean accept(File dir)
      Returns true if the specified file matches the requirements of this filter, and false otherwise.
      Specified by:
      accept in class FileFilter
      Parameters:
      dir - the file or directory.
      Returns:
      A boolean.
    • getDescription

      public String getDescription()
      Returns the filter description.
      Specified by:
      getDescription in class FileFilter
      Returns:
      The filter description.
    • acceptDirectories

      public void acceptDirectories(boolean b)
      Sets the flag that controls whether or not the filter accepts directories.
      Parameters:
      b - a boolean.
    • acceptsDirectories

      public boolean acceptsDirectories()
      Returns the flag that indicates whether or not the filter accepts directories.
      Returns:
      A boolean.