Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remember last file opened

 
mark geroso
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Prof assigned this project... A frame, text area in the center, panel in the south containing a text field. Any text file opened would show its contents in the text area and the path and filename in the text field.

I did it, but I can't figure out how to make it remember which file was last opened.
Say, you run the program, open a text file, save and close the file, then close the program. If you run the program again, it will open the last file accessed automatically.
I thought about assigning the path to a string variable, but won't all variables be cleared when you close the program?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You'd have to save the path into a little preferences file for your program, loaded when your program starts up.
 
mark geroso
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I was thinking of that, I was just hoping there would be a more elegant solution.
I'm gonna go do that now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic