fix for JAL-1315
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index a283c01..4a679b6 100644 (file)
@@ -19,7 +19,6 @@ package jalview.gui;
 
 import java.beans.*;
 import java.io.*;
-import java.util.Hashtable;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -689,7 +688,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
         seqPanel.seqCanvas.fastPaint(scrollX, scrollY);
         scalePanel.repaint();
 
-        if (av.getShowAnnotation())
+        if (av.getShowAnnotation() && scrollX!=0)
         {
           annotationPanel.fastPaint(scrollX);
         }
@@ -1095,7 +1094,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
   void makeAlignmentImage(int type, File file)
   {
     long progress = System.currentTimeMillis();
-    if (alignFrame != null)
+    boolean headless = (System.getProperty("java.awt.headless") != null
+            && System.getProperty("java.awt.headless").equals("true"));
+    if (alignFrame != null && !headless)
     {
       alignFrame.setProgressBar("Saving "
               + (type == jalview.util.ImageMaker.PNG ? "PNG image"
@@ -1116,8 +1117,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
       if (av.getWrapAlignment())
       {
         height = getWrappedHeight();
-        if (System.getProperty("java.awt.headless") != null
-                && System.getProperty("java.awt.headless").equals("true"))
+        if (headless)
         {
           // need to obtain default alignment width and then add in any
           // additional allowance for id margin
@@ -1185,7 +1185,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
       }
     } finally
     {
-      if (alignFrame != null)
+      if (alignFrame != null && !headless)
       {
         alignFrame.setProgressBar("Export complete.", progress);
       }