JAL-244 Allow adjusting Id column width in wrap mode. Set Id column width in gui...
[jalview.git] / src / jalview / gui / AnnotationLabels.java
index afee3d0..241e0a3 100755 (executable)
@@ -1206,6 +1206,7 @@ public class AnnotationLabels extends JPanel
         Graphics dummy = g2d.create();
         int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
                 null);
+        dummy.dispose();
         Dimension d = ap.calculateDefaultAlignmentIdWidth();
         int alignmentIdWidth = d.width;
         if (iwa != null && !iwa.manuallyAdjusted())
@@ -1230,6 +1231,14 @@ public class AnnotationLabels extends JPanel
         }
       }
     }
+    else
+    {
+      Graphics2D g2d = (Graphics2D) g;
+      Graphics dummy = g2d.create();
+      int newAnnotationIdWidth = drawLabels(dummy, clip, width, false,
+              null);
+      width = Math.max(newAnnotationIdWidth, givenWidth);
+    }
     drawLabels(g, clip, width, true, null);
   }
 
@@ -1255,7 +1264,7 @@ public class AnnotationLabels extends JPanel
           boolean actuallyDraw, FontMetrics fmetrics)
   {
     int actualWidth = 0;
-    if (actuallyDraw && g != null)
+    if (g != null)
     {
       if (av.getFont().getSize() < 10)
       {