I have a problem with JFileChooser under Windows XP (JVM version doesn't seem to matter, tried 1.4.2 and above):
The setSelectedFile() method hangs up inside JFileChooser, but only if the file previously selected is located in the user's Desktop. If the previous file resides in other sub folders of 'Documents and Settings/<userName>/...', it works OK, so it's probably not a matter of the spaces in the path.
Under Windows 2000, it works fine.
Does anyone have similar experiences, maybe even a solution or workaround? Google didn't produce any helpful results.
Can you post some code as to how you are implementing the file chooser?
Joined: Dec 22, 2004
The code belong to a File IO component of the software I write. Here the fields: - lastSaveFile is an instance filed holding the file last saved to - model is a method argument, basically providing the format a document was last saved in (XML, txt, etc.) - selectedFormat is the JFileChooser FileFilter matching the saving format - fileKeeper is an instance field, ensuring that the file name in the JFileChooserUI has the appropriate extension if the saving format changes
The line that hangs is fileChooser.setSelectedFile(target);
JConsole shows that the invocation of setSelectedFile() hangs somewhere deep inside Swings PLaF, in FileView.ensureFileVisible(), with some Win32 classes in the stack trace. The final blocking occurs on Unsafe.wait().