• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFileChooser: setSelectedFile() hangs

 
Guido Sautter
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

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.

Thanks in advance,
Guido
 
G Estes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post some code as to how you are implementing the file chooser?
 
Guido Sautter
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().

Thanks for any ideas.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic