Login  Register

JFileChooser bug on Windows (jdk1.6.4)?

Posted by seb-7 on Feb 12, 2008; 2:34pm
URL: http://imagej.273.s1.nabble.com/JFileChooser-bug-on-Windows-jdk1-6-4-tp3697214.html

Hello ImageJers,

There seems to be a funny bug with JFileChooser on windows.
As I recently updated to jdk1.6.4 on a few MSWindows machines, I was
surprised to see it could take a minute to get the directory chooser
from the getDirectory() macro function.

It seems to come from the JFileChooser swing component, this short
plugin snippet gives the same result:

public class testJDirChooser implements PlugIn {

public void run(String arg) {
/*try {
                 
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        }
        catch (Exception e)  {
                IJ.error(e.toString());
                }*/
        JFileChooser chooser = new JFileChooser();
        chooser.setDialogTitle("choose a directory");
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
         chooser.setApproveButtonText("Select");
        chooser.showOpenDialog(IJ.getInstance());
        }

}

Does anybody know if it occurs on other platforms ?
As far as I checked it seems ok on a linux machine, not tested yet on
MacOSX but getDirectory seems ok there.
So even if it's a good idea to get rid of some recently discovered
security holes in previous JVMs, I would think twice about it...

regards,

sebastien