fix for JAL-1315
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index c681409..4a679b6 100644 (file)
@@ -1,13 +1,13 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
+ *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
@@ -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);
       }