KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > neu > ccs > jmk > swing > JmkFilter


1 // $Id: JmkFilter.java,v 1.2 2001/12/07 11:41:24 ramsdell Exp $
2

3 /*
4  * Copyright 1997 by Olivier Refalo
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * @author John D. Ramsdell
21  * @author olivier refalo
22  *
23  */

24
25 package edu.neu.ccs.jmk.swing;
26
27 import java.io.*;
28
29 // this is the filter for the file chooser
30
public final
31 class JmkFilter
32 extends javax.swing.filechooser.FileFilter JavaDoc {
33
34     private final String JavaDoc jmk="jmk";
35     // accept jmk files only.
36
public boolean accept(File f) {
37
38         if (f.isDirectory()) {
39             return(true);
40         }
41
42         String JavaDoc s = f.getName();
43         int i = s.lastIndexOf('.');
44
45         if (i > 0 && i < s.length() - 1) {
46             String JavaDoc extension = s.substring(i+1).toLowerCase();
47             return(jmk.equals(extension));
48         }
49         return(false);
50     }
51
52     // The description of this filter
53
public String JavaDoc getDescription() {
54         return("Jmk makefiles");
55     }
56 }
57
Popular Tags