L
Larry Barowski
Since Sun has not added this information to the
documentation as requested almost two years ago
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4770133 ,
I thought I'd post it here.
For file filters added to JFileChooser with addChoosableFileFilter(),
FileFilter.accept() will be called from threads other than the event
dispatching thread. accept() may be called simultaneously from
multiple threads for different FileFilters, or (unlikely but possible)
for a single FileFilter if it has been added to more than one
JFileChooser. Any code in FileFilter.accept() must be thread-safe
with respect to those possibilities.
For most filters that just use pattern matching on the filename, this
is not a problem. We ran into it because we use dynamic file types
(if the user tells us somefile.blah is a Java source file, then our
"Java source files" filter will accept it).
documentation as requested almost two years ago
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4770133 ,
I thought I'd post it here.
For file filters added to JFileChooser with addChoosableFileFilter(),
FileFilter.accept() will be called from threads other than the event
dispatching thread. accept() may be called simultaneously from
multiple threads for different FileFilters, or (unlikely but possible)
for a single FileFilter if it has been added to more than one
JFileChooser. Any code in FileFilter.accept() must be thread-safe
with respect to those possibilities.
For most filters that just use pattern matching on the filename, this
is not a problem. We ran into it because we use dynamic file types
(if the user tells us somefile.blah is a Java source file, then our
"Java source files" filter will accept it).