Monospaced indicator
[jalview.git] / src / jalview / gui / FontChooser.java
index 33bb9de..6eab36b 100755 (executable)
@@ -71,9 +71,9 @@ public class FontChooser extends GFontChooser
         frame = new JInternalFrame();\r
         frame.setContentPane(this);\r
         if(tp!=null)\r
-           Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 480, 100, false);\r
+           Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 540, 100, false);\r
         else\r
-           Desktop.addInternalFrame(frame, "Change Font", 480, 100, false);\r
+           Desktop.addInternalFrame(frame, "Change Font", 540, 100, false);\r
 \r
         frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
 \r
@@ -98,6 +98,11 @@ public class FontChooser extends GFontChooser
         fontSize.setSelectedItem(oldFont.getSize() + "");\r
         fontStyle.setSelectedIndex(oldFont.getStyle());\r
 \r
+        FontMetrics fm = getGraphics().getFontMetrics(oldFont);\r
+        monospaced.setSelected( fm.getStringBounds("M",getGraphics()).getWidth()\r
+                              ==fm.getStringBounds("|",getGraphics()).getWidth());\r
+\r
+\r
         init = false;\r
     }\r
 \r
@@ -171,6 +176,12 @@ public class FontChooser extends GFontChooser
       {\r
         tp.setTreeFont(newFont);\r
       }\r
+\r
+      FontMetrics fm = getGraphics().getFontMetrics(newFont);\r
+\r
+      monospaced.setSelected( fm.getStringBounds("M",getGraphics()).getWidth()\r
+                                ==fm.getStringBounds("|",getGraphics()).getWidth());\r
+\r
     }\r
 \r
     /**\r