• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JFileChooser: setSelectedFile() hangs

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic