Remove hard-coded font names from UI settings.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4901 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java
index 097b71b..7854b49 100644
--- a/java/com/tigervnc/vncviewer/OptionsDialog.java
+++ b/java/com/tigervnc/vncviewer/OptionsDialog.java
@@ -105,7 +105,7 @@
     addGBComponent(customCompressLevel, tightPanel, 0, 0, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.FIRST_LINE_START, new Insets(0,0,0,0));
     addGBComponent(compressLevel, tightPanel,       0, 1, 1, 1, 2, 2, 0, 0, GridBagConstraints.NONE, GridBagConstraints.FIRST_LINE_START, new Insets(0,20,0,0));
     addGBComponent(compressionLabel, tightPanel,    1, 1, 1, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START, new Insets(0,5,0,0));
-    addGBComponent(noJpeg, tightPanel,              0, 2, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.FIRST_LINE_START, new Insets(0,0,0,0));
+    addGBComponent(noJpeg, tightPanel,              0, 2, 2, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.FIRST_LINE_START, new Insets(4,0,0,0));
     addGBComponent(qualityLevel, tightPanel,        0, 3, 1, 1, 2, 2, 0, 0, GridBagConstraints.NONE, GridBagConstraints.FIRST_LINE_START, new Insets(0,20,0,0));
     addGBComponent(qualityLabel, tightPanel,        1, 3, 1, 1, 2, 2, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.LINE_START, new Insets(0,5,0,0));
 
diff --git a/java/com/tigervnc/vncviewer/VncViewer.java b/java/com/tigervnc/vncviewer/VncViewer.java
index 799ee5d..28a8c19 100644
--- a/java/com/tigervnc/vncviewer/VncViewer.java
+++ b/java/com/tigervnc/vncviewer/VncViewer.java
@@ -81,23 +81,25 @@
       UIManager.put("TitledBorder.titleColor",Color.blue);
       if (UIManager.getLookAndFeel().getName().equals("Metal")) {
         UIManager.put("swing.boldMetal", Boolean.FALSE);
-        FontUIResource f = new FontUIResource("SansSerif", Font.PLAIN, 11);
         java.util.Enumeration keys = UIManager.getDefaults().keys();
         while (keys.hasMoreElements()) {
           Object key = keys.nextElement();
           Object value = UIManager.get(key);
-          if (value instanceof javax.swing.plaf.FontUIResource)
+          if (value instanceof FontUIResource) {
+            String name = ((FontUIResource)value).getName();
+            int style = ((FontUIResource)value).getStyle();
+            int size = ((FontUIResource)value).getSize()-1;
+            FontUIResource f = new FontUIResource(name, style, size);
             UIManager.put(key, f);
+          }
         }
       } else if (UIManager.getLookAndFeel().getName().equals("Nimbus")) {
-        FontUIResource f;
-        String os = System.getProperty("os.name");
-        if (os.startsWith("Windows")) {
-          f = new FontUIResource("Verdana", 0, 11);
-        } else {
-          f = new FontUIResource("DejaVu Sans", 0, 11);
-        }
-      	UIManager.put("TitledBorder.font", f);
+        Font f = UIManager.getFont("TitledBorder.font");
+        String name = f.getName();
+        int style = f.getStyle();
+        int size = f.getSize()-2;
+        FontUIResource r = new FontUIResource(name, style, size);
+      	UIManager.put("TitledBorder.font", r);
       }
     } catch (java.lang.Exception e) { 
       vlog.info(e.toString());