2.4.3 - File Extension Filter - JdlExtFilter

John W. Campbell

2.4.3.1 Introduction

This class provides a File Filter based on the file extension (case insensitive). This file filter may be used in conjunction with the JdlFileChooser file chooser (selector) object.

Class, constructor and methods:

Class Details
Accessible Fields
Constructor
Methods

2.4.3.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlExtFilter
Class definition:
public class JdlExtFilter
Extends:
javax.swing.filechooser.FileFilter
Implements:
none
Actions:
none

2.4.3.3 Accessible Fields

No fields with public, package or protected access defined.

2.4.3.4 Constructor

2.4.3.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

2.4.3.4.2 Standard constructor

Constructs a JdlExtFilter File Filter object based on a file extension.

Constructor Definition:
public JdlExtFilter(String ext, String description)
Parameters List:
ext
The file extension (starting with the dot e.g. .jpeg).
description
A brief description of the file type.

2.4.3.5 Methods

2.4.3.5.1 Introduction

This section contains methods for testing a file name against the filter and for returning the file type description.

Methods:

Accept file - accept
Get description - getDescription

2.4.3.5.2 Accept file - accept

See if the file is to be accepted by comparing its extension with that specified for the file extension filter.

Method Definition:
public boolean accept(File fil)
Parameters List:
fil
The name of the file to be tested.
Method Return:
Returns true if the extension matches, otherwise false.

2.4.3.5.3 Get description - getDescription

This method returns the file type description as set via the constructor.

Method Definition:
public String getDescription()
Parameters List:
none
Method Return:
The file type description.

⇑ Up 2   ⇑ Up 1   ⇑ Top of this