util
Class Filter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended byutil.Filter

public class Filter
extends javax.swing.filechooser.FileFilter

Defines a file filter that can be used when opening and saving files. The filter is used to specify what files to show in the file dialog.

Author:
Mikael Jönsson & Per Klingnäs

Field Summary
private  java.lang.String filter
           
 
Constructor Summary
Filter(java.lang.String filter)
          Constructs the Filter.
 
Method Summary
 boolean accept(java.io.File f)
          Checks if the specified file should be shown or not.
 java.lang.String getDescription()
          The filter's description.
 java.lang.String getExtension(java.io.File f)
          Get the extension (file ending) of a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

private java.lang.String filter
Constructor Detail

Filter

public Filter(java.lang.String filter)
Constructs the Filter.

Parameters:
filter - a string containing the file ending you want to filter
Method Detail

accept

public boolean accept(java.io.File f)
Checks if the specified file should be shown or not.

Parameters:
f - the file to be checked
Returns:
true if the file should be shown; else false

getDescription

public java.lang.String getDescription()
The filter's description.

Returns:
the filter's description

getExtension

public java.lang.String getExtension(java.io.File f)
Get the extension (file ending) of a file.

Parameters:
f - the file which filename we want
Returns:
the file's extension