KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cve > util > ClassFileFilter


1 package cve.util;
2
3 import java.io.File JavaDoc;
4 import javax.swing.filechooser.*;
5
6 import org.apache.log4j.Logger;
7 import cve.staticLayout.Cve;
8
9 public class ClassFileFilter extends FileFilter
10 {
11
12    private String JavaDoc typeFile, description;
13
14    public ClassFileFilter(String JavaDoc typeF, String JavaDoc desc){
15       Cve.errLog.debug("");
16       this.typeFile = typeF;
17       this.description = desc;
18    }
19
20    public boolean accept( File JavaDoc f ) {
21       Cve.errLog.debug("");
22       if( f.isDirectory() )
23       return true;
24
25       String JavaDoc ext = f.getName();
26       int i = ext.lastIndexOf('.');
27       if( i>0 && i<ext.length()-1 ){
28          ext = ext.substring(i+1).toLowerCase();
29       }
30       return ext.equals(typeFile);
31    }
32
33    public String JavaDoc getDescription()
34    {
35       Cve.errLog.debug("");
36       return description;
37    }
38
39 }
Popular Tags