Class DefaultFileFilter.ImageFileFilter

  • Enclosing class:
    DefaultFileFilter

    public static class DefaultFileFilter.ImageFileFilter
    extends javax.swing.filechooser.FileFilter
    Utility file filter to accept all image formats supported by image io.
    See Also:
    ImageIO.getReaderFormatNames()
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String desc
      Description of the filter.
      protected static java.lang.String[] imageFormats
      Holds the accepted file format extensions for images.
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageFileFilter​(java.lang.String description)
      Constructs a new file filter for all supported image formats using the specified description.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.io.File file)
      Returns true if the file is a directory or ends with a known image extension.
      java.lang.String getDescription()
      Returns the description.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • imageFormats

        protected static java.lang.String[] imageFormats
        Holds the accepted file format extensions for images.
      • desc

        protected java.lang.String desc
        Description of the filter.
    • Constructor Detail

      • ImageFileFilter

        public ImageFileFilter​(java.lang.String description)
        Constructs a new file filter for all supported image formats using the specified description.
        Parameters:
        description - The description to use for the file filter.
    • Method Detail

      • accept

        public boolean accept​(java.io.File file)
        Returns true if the file is a directory or ends with a known image extension.
        Specified by:
        accept in class javax.swing.filechooser.FileFilter
        Parameters:
        file - The file to be checked.
        Returns:
        Returns true if the file is accepted.
      • getDescription

        public java.lang.String getDescription()
        Returns the description.
        Specified by:
        getDescription in class javax.swing.filechooser.FileFilter
        Returns:
        Returns the description.