This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get last visited directory in JFileChooser?  RSS feed

 
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: 42972
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!