QJCC homepage

biz.chitec.quarterback.swing
Class FileSelectionField.MyFileFilter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended bybiz.chitec.quarterback.swing.FileSelectionField.MyFileFilter
Enclosing class:
FileSelectionField

private static class FileSelectionField.MyFileFilter
extends javax.swing.filechooser.FileFilter

File filter looking for file extensions or directories only.

Author:
Jeff Dinkins, Dirk Hillbrecht

Field Summary
private  java.util.Set allowedexts
           
private  java.lang.String description
           
private  boolean dironly
           
 
Constructor Summary
FileSelectionField.MyFileFilter()
          Creates a file filter.
FileSelectionField.MyFileFilter(boolean don)
           
FileSelectionField.MyFileFilter(boolean don, java.lang.String descr)
           
FileSelectionField.MyFileFilter(java.lang.String exts, java.lang.String descr)
           
 
Method Summary
 boolean accept(java.io.File f)
          Return true if this file should be shown in the directory pane, false if it shouldn't.
 java.lang.String getDescription()
           
private  java.lang.String getExtension(java.io.File f)
          Return the extension portion of the file's name .
 void setDescription(java.lang.String description)
          Sets the human readable description of this filter.
 void setExtensions(java.lang.String exts)
          Adds a filetype "dot" extension to filter against.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowedexts

private java.util.Set allowedexts

description

private java.lang.String description

dironly

private boolean dironly
Constructor Detail

FileSelectionField.MyFileFilter

public FileSelectionField.MyFileFilter()
Creates a file filter. If no filters are added, then all files are accepted.


FileSelectionField.MyFileFilter

public FileSelectionField.MyFileFilter(boolean don)

FileSelectionField.MyFileFilter

public FileSelectionField.MyFileFilter(boolean don,
                                       java.lang.String descr)

FileSelectionField.MyFileFilter

public FileSelectionField.MyFileFilter(java.lang.String exts,
                                       java.lang.String descr)
Method Detail

accept

public boolean accept(java.io.File f)
Return true if this file should be shown in the directory pane, false if it shouldn't. Files that begin with "." are ignored.

See Also:
getExtension(File), FileFilter.accept(java.io.File)

getExtension

private java.lang.String getExtension(java.io.File f)
Return the extension portion of the file's name .

See Also:
getExtension(File), FileFilter.accept(java.io.File)

setExtensions

public void setExtensions(java.lang.String exts)
Adds a filetype "dot" extension to filter against. For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif": ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif"); Note that the "." before the extension is not needed and will be ignored.


getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String description)
Sets the human readable description of this filter. For example: filter.setDescription("Gif and JPG Images");


QJCC homepage