com.quadrique.jbuildingblocks.gui
Class FileChooserSuffixFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by com.quadrique.jbuildingblocks.gui.FileChooserSuffixFileFilter

public class FileChooserSuffixFileFilter
extends FileFilter

This class is a suffix file filter (i.e. only the files that match the given suffix or set of suffixes are displayed) for the JFileChooser

Author:
Hervé Rivere

Constructor Summary
FileChooserSuffixFileFilter(HashSet<String> zSuffixSet, String zDescription)
          Constructor
FileChooserSuffixFileFilter(String zSuffix, String zDescription)
          Constructor
 
Method Summary
 boolean accept(File zFile)
           
 String getDescription()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileChooserSuffixFileFilter

public FileChooserSuffixFileFilter(String zSuffix,
                                   String zDescription)
Constructor

Parameters:
zSuffix - the suffix file filter. For instance, use ".txt" to only display the ".txt" files. Please note that the filter is not case sensitive (i.e. ".Txt" or ".TXT" would match ".txt")
zDescription - the description string to display in the "Files of type:" field of the JFileChooser. For instance, use "Text Files(*.txt)" if you specify a suffix of the form "txt"

FileChooserSuffixFileFilter

public FileChooserSuffixFileFilter(HashSet<String> zSuffixSet,
                                   String zDescription)
Constructor

Parameters:
zSuffixSet - the set of suffix that are considered valid. For instance, use a set with ".txt" and ".doc" to only display the ".txt" and ".doc" files. Please note that the filter is not case sensitive (i.e. ".Txt" or ".TXT" would match ".txt")
zDescription - the description string to display in the "Files of type:" field of the JFileChooser. For instance, use "Text Files(*.txt)" if you specify a suffix of the form "txt"
Method Detail

accept

public boolean accept(File zFile)
Specified by:
accept in class FileFilter
Parameters:
zFile - the file
Returns:
true if the given file is valid

getDescription

public String getDescription()
Specified by:
getDescription in class FileFilter
Returns:
the description string to display in the "Files of type:" field of the JFileChooser.


Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.