Package jspecview.java
Class AwtDialogFileFilter
java.lang.Object
javax.swing.filechooser.FileFilter
jspecview.java.AwtDialogFileFilter
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:
-
Constructor Summary
ConstructorsConstructorDescriptionIntialises aJSpecViewFileFilter
AwtDialogFileFilter
(String[] filters) Initialises theJSpecViewFileFilter
with an list of extensions to filterAwtDialogFileFilter
(String[] filters, String description) Initialises theJSpecViewFileFilter
with an list of extensions to filter and a description of the filter -
Method Summary
Modifier and TypeMethodDescriptionboolean
Implementation of method from interfaceFileFilter
.void
addExtension
(String extension) Adds an extension to the JSpecViewFileFilterReturns the JSpecViewFileFilter descriptiongetExtension
(File f) Returns the extension of a filevoid
setDescription
(String description) Sets the description for the JSpecViewFileFilter
-
Constructor Details
-
AwtDialogFileFilter
public AwtDialogFileFilter()Intialises aJSpecViewFileFilter
-
AwtDialogFileFilter
Initialises theJSpecViewFileFilter
with an list of extensions to filter- Parameters:
filters
- aString
of filters
-
AwtDialogFileFilter
Initialises theJSpecViewFileFilter
with an list of extensions to filter and a description of the filter- Parameters:
filters
- the array of file extensionsdescription
- the description
-
-
Method Details
-
accept
Implementation of method from interfaceFileFilter
.- Specified by:
accept
in classFileFilter
- Parameters:
f
- the the file to be filtered- Returns:
- true if the file should be shown, otherwise false
-
getExtension
Returns the extension of a file- Parameters:
f
- the file- Returns:
- the extension of a file
-
addExtension
Adds an extension to the JSpecViewFileFilter- Parameters:
extension
- the extension
-
getDescription
Returns the JSpecViewFileFilter description- Specified by:
getDescription
in classFileFilter
- Returns:
- the JSpecViewFileFilter description
-
setDescription
Sets the description for the JSpecViewFileFilter- Parameters:
description
- the description
-