• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser Last Path  RSS feed

 
Binh Lam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Does anyone know how to obtain the path of the last accessed path for the JFileChooser. For example, if the default path for
JFileChooser chooser = new JFileChooser() is "My Documents" and the user open the chooser dialog and save the file named saveFile in C:\\ directory. The next time the chooser dialog open, the path should default to C:\\.

Thanks for you help in advance.
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way is to store this path in a String variable like strLastPath, and store this variable in a properties file or sth. Then you can read this variable and open JFileChooser in the approprtiate folder/directory using JFileChooser(String )'s constructor which takes path.
HTH,
- Manish
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!