KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > DirectoryFilter


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  */

22 package org.enhydra.kelp.common;
23 //
24

25 import javax.swing.filechooser.*;
26 import java.io.*;
27 import java.util.ResourceBundle JavaDoc;
28
29 /**
30  * DirectoryFilter restricts file sets to only those files that are
31  * directories. Use this with JFileChooser to create a directory
32  * chooser.
33  *
34  *
35  * @author Slim Heilpern
36  */

37 public class DirectoryFilter extends javax.swing.filechooser.FileFilter JavaDoc {
38
39     /**
40      * Create a DirectoryFilter for use with the FileChooser dialog.
41      */

42     public DirectoryFilter (){}
43
44     /**
45      * Check to see if the passed in file is a directory.
46      *
47      *
48      * @param f
49      * File to check.
50      *
51      * @return
52      * True if the file is a directory.
53      *
54      */

55     public boolean accept (File f) {
56         return f.isDirectory ();
57     }
58
59     /**
60      * Get a description of this filter.
61      *
62      * @return
63      * The description of this filter.
64      *
65      */

66     public String JavaDoc getDescription () {
67         return new String JavaDoc("Directories");
68     }
69
70 }
71
72
Popular Tags