Class DefaultFileFilter


  • public class DefaultFileFilter
    extends javax.swing.filechooser.FileFilter
    Filter for use in a JFileChooser.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String desc
      Description of accepted files.
      protected java.lang.String ext
      Extension of accepted files.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultFileFilter​(java.lang.String extension, java.lang.String description)
      Constructs a new filter for the specified extension and descpription.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.io.File file)
      Returns true if file is a directory or ends with ext.
      java.lang.String getDescription()
      Returns the description for accepted files.
      java.lang.String getExtension()
      Returns the extension for accepted files.
      void setExtension​(java.lang.String extension)
      Sets the extension for accepted files.
      • Methods inherited from class java.lang.Object

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

      • ext

        protected java.lang.String ext
        Extension of accepted files.
      • desc

        protected java.lang.String desc
        Description of accepted files.
    • Constructor Detail

      • DefaultFileFilter

        public DefaultFileFilter​(java.lang.String extension,
                                 java.lang.String description)
        Constructs a new filter for the specified extension and descpription.
        Parameters:
        extension - The extension to accept files with.
        description - The description of the file format.
    • Method Detail

      • accept

        public boolean accept​(java.io.File file)
        Returns true if file is a directory or ends with ext.
        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 for accepted files.
        Specified by:
        getDescription in class javax.swing.filechooser.FileFilter
        Returns:
        Returns the description.
      • getExtension

        public java.lang.String getExtension()
        Returns the extension for accepted files.
        Returns:
        Returns the extension.
      • setExtension

        public void setExtension​(java.lang.String extension)
        Sets the extension for accepted files.
        Parameters:
        extension - The extension to set.