Browse Source

PrefsDialog now defaults look and feel to teh system default

git-svn-id: http://svn.dmdirc.com/trunk@2187 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5
Gregory Holmes 16 years ago
parent
commit
994930ae4c
1 changed files with 12 additions and 8 deletions
  1. 12
    8
      src/com/dmdirc/ui/swing/dialogs/PreferencesDialog.java

+ 12
- 8
src/com/dmdirc/ui/swing/dialogs/PreferencesDialog.java View File

@@ -48,10 +48,10 @@ public final class PreferencesDialog implements PreferencesInterface {
48 48
      * structure is changed (or anything else that would prevent serialized
49 49
      * objects being unserialized with the new class).
50 50
      */
51
-    private static final long serialVersionUID = 7;
51
+    private static final long serialVersionUID = 8;
52 52
     
53 53
     /** A previously created instance of PreferencesDialog. */
54
-    private static PreferencesDialog me;
54
+    private static PreferencesDialog me = new PreferencesDialog();
55 55
     
56 56
     /** preferences panel. */
57 57
     private SwingPreferencesPanel preferencesPanel;
@@ -66,12 +66,11 @@ public final class PreferencesDialog implements PreferencesInterface {
66 66
     }
67 67
     
68 68
     /** Creates the dialog if one doesn't exist, and displays it. */
69
-    public static synchronized void showPreferencesDialog() {
70
-        if (me == null) {
71
-            me = new PreferencesDialog();
69
+    public static  void showPreferencesDialog() {
70
+        synchronized (me) {
71
+            me.initComponents();
72
+            me.preferencesPanel.requestFocus();
72 73
         }
73
-        me.initComponents();
74
-        me.preferencesPanel.requestFocus();
75 74
     }
76 75
     
77 76
     /**
@@ -241,12 +240,17 @@ public final class PreferencesDialog implements PreferencesInterface {
241 240
      */
242 241
     private void initGUITab() {
243 242
         final LookAndFeelInfo[] plaf = UIManager.getInstalledLookAndFeels();
243
+        final String sysLafClass = UIManager.getSystemLookAndFeelClassName();
244 244
         final String[] lafs = new String[plaf.length];
245 245
         final String tabName = "GUI";
246
+        String sysLafName = "";
246 247
         
247 248
         int i = 0;
248 249
         for (LookAndFeelInfo laf : plaf) {
249 250
             lafs[i++] = laf.getName();
251
+            if (laf.getClassName().equals(sysLafClass)) {
252
+                sysLafName = laf.getName();
253
+            }
250 254
         }
251 255
         
252 256
         preferencesPanel.addCategory(tabName, "");
@@ -272,7 +276,7 @@ public final class PreferencesDialog implements PreferencesInterface {
272 276
                 Config.getOptionBool("general", "showcolourdialog"));
273 277
         preferencesPanel.addComboboxOption(tabName, "ui.lookandfeel",
274 278
                 "Look and feel: ", "The Java Look and Feel to use", lafs,
275
-                Config.getOption("ui", "lookandfeel"), false);
279
+                Config.getOption("ui", "lookandfeel", sysLafName), false);
276 280
         preferencesPanel.addCheckboxOption(tabName, "ui.antialias",
277 281
                 "System anti-alias: ", "Anti-alias all fonts",
278 282
                 Config.getOptionBool("ui", "antialias"));

Loading…
Cancel
Save