-
Notifications
You must be signed in to change notification settings - Fork 0
Save preferences
Frederik Kammel edited this page Dec 25, 2016
·
1 revision
This library provides an easy wrapper for java properties that can be used to save any setting or string on the users hard disk and find it later again. Each class gets its own property file that is saved in the applications AppData folder. Make sure to initialize the library before doing anything else, see the getting started page.
Next, initialize your preferences file by creating a new instance of the Prefs-class:
// if you are in a non-static method
Prefs prefs = new Prefs(this.getClass().getName());
// if you are in a static method
Prefs prefs = new Prefs(MyClass.class.getName());Now just use
prefs.public void setPreference(prefKey, prefValue);and
prefs.getPreference(prefKey, defaultValue);to save and retreive preferences.