Package smile.swing

Class FileChooser.SimpleFileFilter

java.lang.Object
javax.swing.filechooser.FileFilter
smile.swing.FileChooser.SimpleFileFilter
Enclosing class:
FileChooser

public static class FileChooser.SimpleFileFilter extends FileFilter
A simple extension-based file filter. Accept all directories and known file extensions. Extensions are typically found on Windows and Unix, but not on Macinthosh. Case is ignored.
  • Constructor Details

    • SimpleFileFilter

      public SimpleFileFilter(String description, String extension)
      Creates a file filter that accepts the given file type. Note that the "." before the extension is not needed. If provided, it will be ignored.
    • SimpleFileFilter

      public SimpleFileFilter(String description, String... filters)
      Creates a file filter from the given string array and description. Note that the "." before the extension is not needed and will be ignored.
    • SimpleFileFilter

      public SimpleFileFilter(String description, Collection<String> filters)
      Creates a file filter from the given string array and description. Note that the "." before the extension is not needed and will be ignored.
  • Method Details

    • getReadableImageFilter

      public static FileChooser.SimpleFileFilter getReadableImageFilter()
      Returns the filter for readable images.
    • getWritableImageFIlter

      public static FileChooser.SimpleFileFilter getWritableImageFIlter()
      Returns the filter for writable images.
    • accept

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

      public void addExtension(String extension)
      Adds a file type "dot" extension to filter against. Note that the "." before the extension is not needed and will be ignored.
    • getDescription

      public String getDescription()
      Returns the human-readable description of this filter.
      Specified by:
      getDescription in class FileFilter
    • setDescription

      public void setDescription(String description)
      Sets the human-readable description of this filter.