# Class AwtDialogFileFilter

java.lang.Object
javax.swing.filechooser.FileFilter
jspecview.java.AwtDialogFileFilter

public class AwtDialogFileFilter extends FileFilter
A implementation of the `FileFilter` that filters out all files except those with extensions that are added.

Author:
  Debbie-Ann Facey, Khari A. Bryan, Prof Robert J. Lancashire
See Also:
  - `addExtension(java.lang.String)`

## Constructor Summary

Constructors
Constructor
Description
`AwtDialogFileFilter()`
Intialises a `JSpecViewFileFilter`
`AwtDialogFileFilter(String[] filters)`
Initialises the `JSpecViewFileFilter` with an list of extensions to filter
`AwtDialogFileFilter(String[] filters, String description)`
Initialises the `JSpecViewFileFilter` with an list of extensions to filter and a description of the filter

## Method Summary

Modifier and Type
Method
Description
`boolean`
`accept(File f)`
Implementation of method from interface `FileFilter`.
`void`
`addExtension(String extension)`
Adds an extension to the JSpecViewFileFilter
`String`
`getDescription()`
Returns the JSpecViewFileFilter description
`String`
`getExtension(File f)`
Returns the extension of a file
`void`
`setDescription(String description)`
Sets the description for the JSpecViewFileFilter

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AwtDialogFileFilter

public AwtDialogFileFilter()
Intialises a `JSpecViewFileFilter`

### AwtDialogFileFilter

public AwtDialogFileFilter(String[] filters)
Initialises the `JSpecViewFileFilter` with an list of extensions to filter

Parameters:
  `filters` - a `String` of filters

### AwtDialogFileFilter

public AwtDialogFileFilter(String[] filters, String description)
Initialises the `JSpecViewFileFilter` with an list of extensions to filter and a description of the filter

Parameters:
  `filters` - the array of file extensions
  `description` - the description

## Method Details

### accept

public boolean accept(File f)
Implementation of method from interface `FileFilter`.

Specified by:
  `accept` in class `FileFilter`
Parameters:
  `f` - the the file to be filtered
Returns:
  true if the file should be shown, otherwise false

### getExtension

public String getExtension(File f)
Returns the extension of a file

Parameters:
  `f` - the file
Returns:
  the extension of a file

### addExtension

public void addExtension(String extension)
Adds an extension to the JSpecViewFileFilter

Parameters:
  `extension` - the extension

### getDescription

public String getDescription()
Returns the JSpecViewFileFilter description

Specified by:
  `getDescription` in class `FileFilter`
Returns:
  the JSpecViewFileFilter description

### setDescription

public void setDescription(String description)
Sets the description for the JSpecViewFileFilter

Parameters:
  `description` - the description