• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser

 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a background thread I create a JFileChooser like this:



This works but does something else too. It goes to the C:\ drive and looks at each of the shortcuts and if the shortcut is invalid (points to a non-existant file) it pops-up a dialog box saying windows is looking for the file. Seems to do this process twice - I'm guessing once in the constructor and again during the setFileSelectionMode() method.

Why is it doing this and how do I prevent the pop-ups?

ms
 
Nikhil Ramani
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try using this code ....


JFileChooser chooser = new JFileChooser();

chooser.setVisible(true);
chooser.setCurrentDirectory(new File("c:/"));

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!