check annotation label widths as well as id widths
authoramwaterhouse <Andrew Waterhouse>
Thu, 7 Apr 2005 16:59:48 +0000 (16:59 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 7 Apr 2005 16:59:48 +0000 (16:59 +0000)
src/jalview/gui/AlignmentPanel.java

index 75729c3..c38b7dc 100755 (executable)
@@ -156,6 +156,20 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
          i++;\r
        }\r
 \r
+       // Also check annotation label widths\r
+       i=0;\r
+       if(al.getAlignmentAnnotation()!=null)\r
+       {\r
+         fm = g.getFontMetrics(alabels.getFont());\r
+         while (i < al.getAlignmentAnnotation().length)\r
+         {\r
+           String label = al.getAlignmentAnnotation()[i].label;\r
+           if (fm.stringWidth(label) > idWidth)\r
+             idWidth = fm.stringWidth(label);\r
+           i++;\r
+         }\r
+       }\r
+\r
        return new Dimension(idWidth, 12);\r
   }\r
 \r