3

In C# .NET there is a built in Settings.settings file that allow to easily store form related properties such as positions, sizes, and states at user level.

Is there something similar in Java ? Whats the best way to save and restore frame related settings in Java ?

aleroot
  • 71,077
  • 30
  • 176
  • 213
  • 2
    Use Preferences class as described here: http://stackoverflow.com/questions/4017137/how-do-i-save-preference-user-settings-in-java – Vlad Jan 06 '12 at 14:24
  • regarding the specific requirement of saving and restoring **UI states**, you may want to take a look at GUTS-GUI SessionManager (http://guts.kenai.com/guts-base/guts-gui/apidocs/net/guts/gui/session/package-summary.html#package_description). This requires Guice, but I believe the code can be easily adapted. – jfpoilpret Jan 10 '12 at 15:07

1 Answers1

2

The Preferences API can help you in this regard.

Applications require preference and configuration data to adapt to the needs of different users and environments. The java.util.prefs package provides a way for applications to store and retrieve user and system preference and configuration data. The data is stored persistently in an implementation-dependent backing store. There are two separate trees of preference nodes, one for user preferences and one for system preferences.

Catalina Island
  • 7,027
  • 2
  • 23
  • 42
parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85