mirror of
https://gitlab.com/kauron/jstudy
synced 2024-12-22 16:33: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;
|
package es.kauron.jstudy.model;
|
||||||
|
|
||||||
|
import es.kauron.jstudy.Main;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -7,7 +8,7 @@ import java.util.prefs.BackingStoreException;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class AppPrefs {
|
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 repeatWrong = new BooleanPref(false, "repeatWrong");
|
||||||
public static final BooleanPref showFeedback = new BooleanPref(true, "showFeedback");
|
public static final BooleanPref showFeedback = new BooleanPref(true, "showFeedback");
|
||||||
public static final BooleanPref repeatImmediately = new BooleanPref(false, "repeatImmediately");
|
public static final BooleanPref repeatImmediately = new BooleanPref(false, "repeatImmediately");
|
||||||
|
@ -28,15 +29,10 @@ public class AppPrefs {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void save() {
|
public static void save() {
|
||||||
Preferences prefs = Preferences.userRoot();
|
|
||||||
prefs.put("lastDir", lastDir == null ? "" : lastDir.getAbsolutePath());
|
prefs.put("lastDir", lastDir == null ? "" : lastDir.getAbsolutePath());
|
||||||
flushPrefs();
|
flushPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String printValues() {
|
|
||||||
return String.format("repeatWrong=%b\nshowFeedback=%b", repeatWrong, showFeedback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BooleanPref extends SimpleBooleanProperty {
|
public static class BooleanPref extends SimpleBooleanProperty {
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue