Repaint annotations after edit
authoramwaterhouse <Andrew Waterhouse>
Tue, 30 Aug 2005 14:33:02 +0000 (14:33 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 30 Aug 2005 14:33:02 +0000 (14:33 +0000)
src/jalview/gui/AnnotationPanel.java

index 4f984fd..8a262d9 100755 (executable)
@@ -531,24 +531,18 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 \r
       imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
 \r
-      if (image != null && imgWidth == image.getWidth())\r
+      if (image == null || imgWidth != image.getWidth())\r
       {\r
-        //This will be called by a mouse over, tool tip etc\r
-        // no need to redraw whole image\r
-        g.drawImage(image, 0, 0, this);\r
-        fastPaint = false;\r
-        return;\r
+        image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),\r
+                                  BufferedImage.TYPE_INT_RGB);\r
+        gg = (Graphics2D) image.getGraphics();\r
+        gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                            RenderingHints.VALUE_ANTIALIAS_ON);\r
+\r
+        gg.setFont(av.getFont());\r
+        fm = gg.getFontMetrics();\r
       }\r
 \r
-      image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),\r
-                                BufferedImage.TYPE_INT_RGB);\r
-      gg = (Graphics2D) image.getGraphics();\r
-      gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
-                          RenderingHints.VALUE_ANTIALIAS_ON);\r
-\r
-      gg.setFont(av.getFont());\r
-      fm = gg.getFontMetrics();\r
-\r
       drawComponent(gg, av.startRes, av.endRes + 1);\r
       g.drawImage(image, 0, 0, this);\r
     }\r