fix for JAL-1315
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Thu, 13 Jun 2013 15:53:33 +0000 (16:53 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Thu, 13 Jun 2013 15:53:33 +0000 (16:53 +0100)
src/jalview/gui/AlignmentPanel.java

index 5f20808..4a679b6 100644 (file)
@@ -1094,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"
@@ -1115,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
@@ -1184,7 +1185,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
       }
     } finally
     {
-      if (alignFrame != null)
+      if (alignFrame != null && !headless)
       {
         alignFrame.setProgressBar("Export complete.", progress);
       }