Monospaced indicator
authoramwaterhouse <Andrew Waterhouse>
Mon, 30 Jan 2006 14:55:58 +0000 (14:55 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 30 Jan 2006 14:55:58 +0000 (14:55 +0000)
src/jalview/gui/FontChooser.java
src/jalview/jbgui/GFontChooser.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
index 0aeeb34..38bddef 100755 (executable)
@@ -48,8 +48,10 @@ public class GFontChooser extends JPanel
     BorderLayout borderLayout3 = new BorderLayout();\r
     FlowLayout flowLayout1 = new FlowLayout();\r
     protected JButton defaultButton = new JButton();\r
+   protected  JCheckBox monospaced = new JCheckBox();\r
+  BorderLayout borderLayout4 = new BorderLayout();\r
 \r
-    /**\r
+  /**\r
      * Creates a new GFontChooser object.\r
      */\r
     public GFontChooser()\r
@@ -142,8 +144,10 @@ public class GFontChooser extends JPanel
         jPanel3.setOpaque(false);\r
         jPanel3.setLayout(borderLayout2);\r
         flowLayout1.setAlignment(FlowLayout.CENTER);\r
-        flowLayout1.setVgap(5);\r
-        defaultButton.setText("Set as Default");\r
+    flowLayout1.setHgap(1);\r
+    flowLayout1.setVgap(5);\r
+    defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    defaultButton.setText("Set as Default");\r
         defaultButton.addActionListener(new ActionListener()\r
             {\r
                 public void actionPerformed(ActionEvent e)\r
@@ -151,19 +155,25 @@ public class GFontChooser extends JPanel
                     defaultButton_actionPerformed(e);\r
                 }\r
             });\r
-        this.add(jPanel1, null);\r
+    monospaced.setEnabled(false);\r
+    monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    monospaced.setOpaque(false);\r
+    monospaced.setToolTipText("Monospaced fonts are faster to render");\r
+    monospaced.setText("Monospaced");\r
+    this.add(jPanel1, null);\r
         jPanel1.add(jLabel1, BorderLayout.WEST);\r
         jPanel1.add(fontName, BorderLayout.CENTER);\r
-        this.add(jPanel3, null);\r
+    this.add(monospaced);\r
+    this.add(jPanel3, null);\r
         this.add(jPanel2, null);\r
         jPanel2.add(jLabel3, BorderLayout.WEST);\r
         jPanel2.add(fontStyle, BorderLayout.CENTER);\r
-        jPanel3.add(jLabel2, BorderLayout.WEST);\r
+    jPanel3.add(jLabel2, BorderLayout.WEST);\r
         jPanel3.add(fontSize, BorderLayout.CENTER);\r
         this.add(ok, null);\r
         this.add(cancel, null);\r
         this.add(defaultButton);\r
-    }\r
+  }\r
 \r
     /**\r
      * DOCUMENT ME!\r