-
Enhancement
-
Resolution: Fixed
-
P3
-
1.3.0, 1.3.1, 1.4.1
-
b72
-
generic, x86, sparc
-
generic, linux, solaris_8
In JFileChooser you can selectively show the exact files you want the
user to deal with by providing a FileFilter. The FileFilter class is
abstract, and no default implementation is provided.
While it's relatively easy to implement a FileFilter class, this is a
conceptual hurdle - ya'mean'I'gotta'write'some'extra'code whining, in other
words. This is yet another example of atoms, where a couple simple-to-use
molecules would be useful in addition. For example many of the other
complex components provide DefaultXXXModel objects that tend to make it
easier to use the component, so why not FileFilter.
This is doubly true given the example in the javadoc, where you suggest the
programmer use "ExampleFileFilter" and say
filter.addExtension("gif");
filter.addExtension("jpg");
No doubt legions of programmers have read that suggestion, looked around in
desparation for the ExampleFileFilter class, and whined about having to
write it themselves.
So here's the proposal; provide DefaultFileFilter as an implementation of
the FileFilter abstract class. The API would be as suggested by the
JFileFilter javadoc:
addExtension(String) - Add's an extension to be considered.
removeExtension(String) - Removes an extension from consideration
setDescription(String) - Set the description
user to deal with by providing a FileFilter. The FileFilter class is
abstract, and no default implementation is provided.
While it's relatively easy to implement a FileFilter class, this is a
conceptual hurdle - ya'mean'I'gotta'write'some'extra'code whining, in other
words. This is yet another example of atoms, where a couple simple-to-use
molecules would be useful in addition. For example many of the other
complex components provide DefaultXXXModel objects that tend to make it
easier to use the component, so why not FileFilter.
This is doubly true given the example in the javadoc, where you suggest the
programmer use "ExampleFileFilter" and say
filter.addExtension("gif");
filter.addExtension("jpg");
No doubt legions of programmers have read that suggestion, looked around in
desparation for the ExampleFileFilter class, and whined about having to
write it themselves.
So here's the proposal; provide DefaultFileFilter as an implementation of
the FileFilter abstract class. The API would be as suggested by the
JFileFilter javadoc:
addExtension(String) - Add's an extension to be considered.
removeExtension(String) - Removes an extension from consideration
setDescription(String) - Set the description
- duplicates
-
JDK-4423406 RFE: ExampleFileFilter corrections
-
- Closed
-