• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get last visited directory in JFileChooser?

 
dheeraj chhabra
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I m using a swing application.

I just want to know if i select any fuile in JFileChooser once then if i again go to select file then it must open the last visited directory.

Can anybody tell me how to do that?

Thanks
Dheeraj
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you create a FileChooser, you can specify which directory it should show in the constructor (public JFileChooser(File currentDirectory)). Just remember the directory when someone opens a file, so that you can use it the next time the file chooser is opened.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!