3 import java.awt.image.*;
7 import java.util.zip.*;
8 import java.util.Locale;
10 import javax.swing.filechooser.*;
14 import ij.plugin.frame.*;
15 import ij.text.TextWindow;
17 import java.util.LinkedList;
18 import java.util.Iterator;
22 private String[] _extensions = null;
23 private String _description =
"";
24 private boolean _showExtensions =
true;
28 this._description = description;
29 this._extensions = extensions;
34 String[] exts =
new String[extensions.size()];
36 for (Iterator itr = extensions.iterator(); itr.hasNext(); i++) {
37 exts[i] = (String)itr.next();
39 this._description = description;
40 this._extensions = exts;
44 public boolean accept(File f)
46 if (f.isDirectory())
return true;
47 String extension = f.getPath();
48 extension = extension.substring(extension.lastIndexOf(
".")+1).toLowerCase();
49 for (
int i=0; i < _extensions.length; i++) {
50 if (extension.equalsIgnoreCase(_extensions[i])) {
57 public String getDescription()
59 return _description + (_showExtensions ?
" (" + _getExtensionList() +
")" :
"");
62 private String _getExtensionList()
64 StringBuffer sb =
new StringBuffer();
65 for (
int i=0; i < _extensions.length; i++) {
67 sb.append(_extensions[i]);
70 return sb.substring(0, sb.length()-2);
73 public String[] getExtensions()
78 public void setShowExtensions(
boolean b)