public class ExtensionFileFilter extends FileFilter implements FileFilter
JFileChooser
to filter the
displayed files by their extension.Constructor and Description |
---|
ExtensionFileFilter()
Builds a new ExtensionFileFilter.
|
ExtensionFileFilter(String description,
String... extensions)
Creates a FileNameExtensionFilter with the specified description and
file name extensions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(File f)
Checks a file for compliance with the requested extensions.
|
void |
addExtension(String extension)
Adds a new extension to the list of accepted extensions.
|
String |
getDescription()
Returns the user-frielndly description for the files, e.g.
|
String[] |
getExtensions() |
void |
setDescription(String description)
Sets the user friendly description for the accepted files.
|
String |
toString() |
public ExtensionFileFilter()
public ExtensionFileFilter(String description, String... extensions)
description
- textual description for the filter, may be nullextensions
- the accepted file name extensionspublic boolean accept(File f)
accept
in interface FileFilter
accept
in class FileFilter
f
- file to test with this filterpublic String getDescription()
getDescription
in class FileFilter
public void addExtension(String extension)
extension
- file extension used to filter filespublic void setDescription(String description)
description
- description for this file filterpublic String[] getExtensions()
Copyright © 2024 GATE. All rights reserved.