01: /*
02: * ClassFileFilter.java Copyright (c) 2006,07 Swaroop Belur
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08:
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13:
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17: *
18: */
19:
20: package net.sf.jdec.ui.util;
21:
22: import java.io.File;
23: import javax.swing.filechooser.FileFilter;
24:
25: public class ClassFileFilter extends FileFilter {
26: private String fileTypeDescription = "Java Class File";
27: private String fileType = "class";
28:
29: public ClassFileFilter() {
30: }
31:
32: public String getDescription() {
33: return fileTypeDescription;
34: }
35:
36: public boolean accept(File f) {
37: if (f == null)
38: return false;
39: if (f.isDirectory())
40: return true;
41: return f.getName().toLowerCase().endsWith(fileType);
42: }
43: }
|