KickJava   Java API By Example, From Geeks To Geeks.

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


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

23 package org.enhydra.tool.common;
24
25 //
26

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

39 public class DirectoryFilter extends javax.swing.filechooser.FileFilter JavaDoc {
40     static ResourceBundle JavaDoc res =
41         ResourceBundle.getBundle ("org.enhydra.tool.common.Res");
42
43     /**
44      * Create a DirectoryFilter for use with the FileChooser dialog.
45      */

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

59     public boolean accept (File f) {
60         return f.isDirectory ();
61     }
62
63     /**
64      * Get a description of this filter.
65      *
66      * @return
67      * The description of this filter.
68      *
69      */

70     public String JavaDoc getDescription () {
71         return res.getString ("Directories");
72     }
73
74 }
75
76
Popular Tags