X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosUIPreferences.java;h=03e8e1290936e21de066365f44e1f7a9fe4e4d7f;hb=ec036e8fe057f4b641ba9ee17d6dce2689816047;hp=8f1e45d93e5e48116ac077fe4ef1d8cf6f54ed90;hpb=fe009534ce6846b6db96cac8f6c2d53ba8010d91;p=fw%2Faltos diff --git a/altosui/AltosUIPreferences.java b/altosui/AltosUIPreferences.java index 8f1e45d9..03e8e129 100644 --- a/altosui/AltosUIPreferences.java +++ b/altosui/AltosUIPreferences.java @@ -19,12 +19,8 @@ package altosui; import java.io.*; import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; import java.awt.Component; import javax.swing.*; -import javax.swing.filechooser.FileSystemView; import org.altusmetrum.AltosLib.*; public class AltosUIPreferences extends AltosPreferences { @@ -52,12 +48,12 @@ public class AltosUIPreferences extends AltosPreferences { public static void init() { font_listeners = new LinkedList(); - font_size = preferences.getInt(fontSizePreference, Altos.font_size_medium); + font_size = backend.getInt(fontSizePreference, Altos.font_size_medium); Altos.set_fonts(font_size); - look_and_feel = preferences.get(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName()); + look_and_feel = backend.getString(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName()); ui_listeners = new LinkedList(); - serial_debug = preferences.getBoolean(serialDebugPreference, false); + serial_debug = backend.getBoolean(serialDebugPreference, false); AltosLink.set_debug(serial_debug); } @@ -111,9 +107,9 @@ public class AltosUIPreferences extends AltosPreferences { } public static void set_font_size(int new_font_size) { - synchronized (preferences) { + synchronized (backend) { font_size = new_font_size; - preferences.putInt(fontSizePreference, font_size); + backend.putInt(fontSizePreference, font_size); flush_preferences(); Altos.set_fonts(font_size); for (AltosFontListener l : font_listeners) @@ -122,13 +118,13 @@ public class AltosUIPreferences extends AltosPreferences { } public static void register_font_listener(AltosFontListener l) { - synchronized (preferences) { + synchronized (backend) { font_listeners.add(l); } } public static void unregister_font_listener(AltosFontListener l) { - synchronized (preferences) { + synchronized (backend) { font_listeners.remove(l); } } @@ -138,9 +134,9 @@ public class AltosUIPreferences extends AltosPreferences { UIManager.setLookAndFeel(new_look_and_feel); } catch (Exception e) { } - synchronized(preferences) { + synchronized(backend) { look_and_feel = new_look_and_feel; - preferences.put(lookAndFeelPreference, look_and_feel); + backend.putString(lookAndFeelPreference, look_and_feel); flush_preferences(); for (AltosUIListener l : ui_listeners) l.ui_changed(look_and_feel); @@ -154,21 +150,21 @@ public class AltosUIPreferences extends AltosPreferences { } public static void register_ui_listener(AltosUIListener l) { - synchronized(preferences) { + synchronized(backend) { ui_listeners.add(l); } } public static void unregister_ui_listener(AltosUIListener l) { - synchronized (preferences) { + synchronized (backend) { ui_listeners.remove(l); } } public static void set_serial_debug(boolean new_serial_debug) { - AltosLink.set_debug(new_serial_debug); - synchronized (preferences) { + AltosLink.set_debug(serial_debug); + synchronized (backend) { serial_debug = new_serial_debug; - preferences.putBoolean(serialDebugPreference, serial_debug); + backend.putBoolean(serialDebugPreference, serial_debug); flush_preferences(); } } @@ -179,4 +175,4 @@ public class AltosUIPreferences extends AltosPreferences { } } -} \ No newline at end of file +}