File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ok, how do common apps do this?

 
Doyle Matt
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm about to do an app that actually saves it state. For example, my app has a
checkbutton in it, an supposing i enabled it and then closed the swing app, how will i make the app so that the next time it starts the checkbutton is still enabled or disabled depending on the last time i used it?

Is this where serialization takes place?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I wouldn't use serialization for this, I'd just use a Properties file. See the java.util.Properties class. Make up a property name like "doodad.checkbox.state" and set its value to "true" or "false" in the application's Properties object when you dismiss the dialog box. It's best to have a class whose job it is to wrap the Properties, and save it to disk whenever a value changes.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should also take a look at the Preferences API: http://java.sun.com/j2se/1.4.2/docs/guide/lang/preferences.html
 
Doyle Matt
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic