diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2012-04-25 21:20:24 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2012-04-25 21:20:24 +0000 |
commit | 5be8fa01edeb1e09a60cedcc400f48cea97f497b (patch) | |
tree | 4815efad5e3494df8f7130faaaed383433364b16 /java/com | |
parent | f52740e7eaead1170e20f25c7da79a98da97d6ff (diff) | |
download | tigervnc-5be8fa01edeb1e09a60cedcc400f48cea97f497b.tar.gz tigervnc-5be8fa01edeb1e09a60cedcc400f48cea97f497b.zip |
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
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/tigervnc/vncviewer/OptionsDialog.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/VncViewer.java | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java index 097b71b9..7854b49f 100644 --- a/java/com/tigervnc/vncviewer/OptionsDialog.java +++ b/java/com/tigervnc/vncviewer/OptionsDialog.java @@ -105,7 +105,7 @@ class OptionsDialog extends Dialog implements 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 799ee5d8..28a8c196 100644 --- a/java/com/tigervnc/vncviewer/VncViewer.java +++ b/java/com/tigervnc/vncviewer/VncViewer.java @@ -81,23 +81,25 @@ public class VncViewer extends java.applet.Applet implements Runnable 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()); |