Revision: 4901 http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4901&view=rev Author: bphinz Date: 2012-04-25 21:20:24 +0000 (Wed, 25 Apr 2012) Log Message: ----------- Remove hard-coded font names from UI settings.
Modified Paths: -------------- trunk/java/com/tigervnc/vncviewer/OptionsDialog.java trunk/java/com/tigervnc/vncviewer/VncViewer.java Modified: trunk/java/com/tigervnc/vncviewer/OptionsDialog.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/OptionsDialog.java 2012-04-25 15:43:56 UTC (rev 4900) +++ trunk/java/com/tigervnc/vncviewer/OptionsDialog.java 2012-04-25 21:20:24 UTC (rev 4901) @@ -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)); Modified: trunk/java/com/tigervnc/vncviewer/VncViewer.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/VncViewer.java 2012-04-25 15:43:56 UTC (rev 4900) +++ trunk/java/com/tigervnc/vncviewer/VncViewer.java 2012-04-25 21:20:24 UTC (rev 4901) @@ -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()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Tigervnc-commits mailing list Tigervnc-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-commits