mirror of
https://gitlab.com/kauron/jstudy
synced 2024-12-22 08:23:33 +01:00
Settings: moved preference to package
This commit is contained in:
parent
dd50ffdcff
commit
3d41dbf779
1 changed files with 2 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
package es.kauron.jstudy.model;
|
||||
|
||||
import es.kauron.jstudy.Main;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -7,7 +8,7 @@ import java.util.prefs.BackingStoreException;
|
|||
import java.util.prefs.Preferences;
|
||||
|
||||
public class AppPrefs {
|
||||
private static final Preferences prefs = Preferences.userRoot();
|
||||
private static final Preferences prefs = Preferences.userNodeForPackage(Main.class);
|
||||
public static final BooleanPref repeatWrong = new BooleanPref(false, "repeatWrong");
|
||||
public static final BooleanPref showFeedback = new BooleanPref(true, "showFeedback");
|
||||
public static final BooleanPref repeatImmediately = new BooleanPref(false, "repeatImmediately");
|
||||
|
@ -28,15 +29,10 @@ public class AppPrefs {
|
|||
}
|
||||
|
||||
public static void save() {
|
||||
Preferences prefs = Preferences.userRoot();
|
||||
prefs.put("lastDir", lastDir == null ? "" : lastDir.getAbsolutePath());
|
||||
flushPrefs();
|
||||
}
|
||||
|
||||
public static String printValues() {
|
||||
return String.format("repeatWrong=%b\nshowFeedback=%b", repeatWrong, showFeedback);
|
||||
}
|
||||
|
||||
public static class BooleanPref extends SimpleBooleanProperty {
|
||||
private final String name;
|
||||
|
||||
|
|
Loading…
Reference in a new issue