Sequence is char []
[jalview.git] / src / jalview / gui / IdCanvas.java
index 0fe986a..9fcbb6e 100755 (executable)
@@ -44,6 +44,8 @@ public class IdCanvas extends JPanel
     boolean fastPaint = false;\r
     java.util.Vector searchResults;\r
     FontMetrics fm;\r
+    AnnotationLabels labels = null;\r
+    AnnotationPanel ap;\r
 \r
     /**\r
      * Creates a new IdCanvas object.\r
@@ -239,13 +241,16 @@ public class IdCanvas extends JPanel
             maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
 \r
           int annotationHeight = 0;\r
-          AnnotationLabels labels = null;\r
+\r
 \r
           if(av.showAnnotation)\r
           {\r
-            AnnotationPanel ap = new AnnotationPanel(av);\r
+            if (ap == null)\r
+              ap = new AnnotationPanel(av);\r
+\r
             annotationHeight = ap.adjustPanelHeight();\r
-            labels = new AnnotationLabels(av);\r
+            if (labels == null)\r
+              labels = new AnnotationLabels(av);\r
           }\r
 \r
           int hgap = av.charHeight;\r
@@ -277,14 +282,12 @@ public class IdCanvas extends JPanel
                 drawIdString(gg, s, i, 0, ypos);\r
               }\r
 \r
-                if(labels!=null)\r
+                if(labels!=null && av.showAnnotation)\r
                 {\r
                   gg.translate(0, ypos+(alheight * av.charHeight));\r
                   labels.drawComponent(gg, getWidth());\r
                   gg.translate(0, -ypos-(alheight * av.charHeight));\r
                 }\r
-\r
-\r
             }\r
         }\r
         else\r