com.evanmclean.evlib.swing.filechooser
Class ExtFilesFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by com.evanmclean.evlib.swing.filechooser.ExtFilesFilter

public class ExtFilesFilter
extends FileFilter

File filter for the JFileChooser that accepts files of the specified extension(s).

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Constructor Summary
ExtFilesFilter(String description)
           
ExtFilesFilter(String description, String ext)
           
ExtFilesFilter(String description, String ext, String... exts_arr)
           
 
Method Summary
 boolean accept(File file)
           
 boolean addExtension(String ext)
          Add an extension to be allowed.
 String getDescription()
           
 String[] getExtensions()
           
 boolean isFilesOnly()
           
 boolean isShowFolders()
           
 boolean removeExtension(String ext)
          Remove the extension from the filer.
 void setFilesOnly(boolean files_only)
          Set if the filer does not accepts folders (directories) with one of the allowed extensions (default true).
 void setShowFolders(boolean show_folders)
          Set if the filter accepts folders (directories) irrespective of the extension (default true).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtFilesFilter

public ExtFilesFilter(String description)

ExtFilesFilter

public ExtFilesFilter(String description,
                      String ext)

ExtFilesFilter

public ExtFilesFilter(String description,
                      String ext,
                      String... exts_arr)
Method Detail

accept

public boolean accept(File file)
Specified by:
accept in class FileFilter

addExtension

public boolean addExtension(String ext)
Add an extension to be allowed.

Parameters:
ext -
Returns:
true if the extension is not already included.

getDescription

public String getDescription()
Specified by:
getDescription in class FileFilter

getExtensions

public String[] getExtensions()
Returns:
The current set of extensions.

isFilesOnly

public boolean isFilesOnly()
Returns:
Returns true if the filter does not accept folders (directories) with one of the allowed extensions (default true).

isShowFolders

public boolean isShowFolders()
Returns:
Returns true if the filter accepts folders (directories) irrespective of the extension (default true).

removeExtension

public boolean removeExtension(String ext)
Remove the extension from the filer.

Parameters:
ext -
Returns:
True if the extension was being filtered.

setFilesOnly

public void setFilesOnly(boolean files_only)
Set if the filer does not accepts folders (directories) with one of the allowed extensions (default true).

Parameters:
files_only -

setShowFolders

public void setShowFolders(boolean show_folders)
Set if the filter accepts folders (directories) irrespective of the extension (default true).

Parameters:
show_folders -