No need to create tmpAnnotationPanel every paint
authoramwaterhouse <Andrew Waterhouse>
Tue, 28 Nov 2006 09:44:11 +0000 (09:44 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 28 Nov 2006 09:44:11 +0000 (09:44 +0000)
src/jalview/gui/IdCanvas.java

index 0fe986a..b2a5ede 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