Class GenericFileFilter



  • public class GenericFileFilter
    extends javax.swing.filechooser.FileFilter
    • Constructor Summary

      Constructors 
      Constructor Description
      GenericFileFilter​(java.lang.String[] filesExtsIn, java.lang.String description)
      This is the constructor - it takes in the following:-
      filesExtsIn - this is the array of file extensions that you wish to create a file filter for.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.io.File f)
      This is the method to allow a file to bee added to the displayed list or not.
      java.lang.String getDescription​()
      This is the method defined by the model
      static java.lang.String getExtension​(java.io.File file)
      This is the method to get the file extension from the file name
      java.lang.String getFileExtent​()
      Get file extent
      • Methods inherited from class java.lang.Object

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

      • GenericFileFilter

        public GenericFileFilter​(java.lang.String[] filesExtsIn,
                                 java.lang.String description)
        This is the constructor - it takes in the following:-
        filesExtsIn - this is the array of file extensions that you wish to create a file filter for.
        description - this is the description that will be displayed in the file chooser dialog box.
    • Method Detail

      • accept

        public boolean accept​(java.io.File f)
        This is the method to allow a file to bee added to the displayed list or not. This method is called by the model that handles the FileChooser dialog
        Specified by:
        accept in class javax.swing.filechooser.FileFilter
      • getDescription

        public java.lang.String getDescription​()
        This is the method defined by the model
        Specified by:
        getDescription in class javax.swing.filechooser.FileFilter
      • getFileExtent

        public java.lang.String getFileExtent​()
        Get file extent
        Returns:
        File extent
      • getExtension

        public static java.lang.String getExtension​(java.io.File file)
        This is the method to get the file extension from the file name