From 3d41dbf77993c16a412dc6b594c4333aac32dffd Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Tue, 10 Sep 2019 19:21:56 +0200 Subject: [PATCH] Settings: moved preference to package --- src/main/java/es/kauron/jstudy/model/AppPrefs.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/es/kauron/jstudy/model/AppPrefs.java b/src/main/java/es/kauron/jstudy/model/AppPrefs.java index 2d07b5e..81f909c 100644 --- a/src/main/java/es/kauron/jstudy/model/AppPrefs.java +++ b/src/main/java/es/kauron/jstudy/model/AppPrefs.java @@ -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;