OptionPanes invokeLater
[jalview.git] / src / jalview / gui / IdCanvas.java
index d35a0f4..30152cc 100755 (executable)
@@ -183,13 +183,13 @@ public class IdCanvas extends JPanel
             return;\r
         }\r
 \r
-        if(oldHeight!=imgHeight)\r
+        if(oldHeight!=imgHeight || image.getWidth(this)!=getWidth())\r
         {\r
           image = new BufferedImage(getWidth(), imgHeight,\r
                                     BufferedImage.TYPE_INT_RGB);\r
-          gg = (Graphics2D) image.getGraphics();\r
         }\r
 \r
+        gg = (Graphics2D) image.getGraphics();\r
         //Fill in the background\r
         gg.setColor(Color.white);\r
         gg.fillRect(0, 0, getWidth(), imgHeight);\r