JAL-2959 no Print dialog shown if Page Format is Cancelled
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 24 Apr 2018 14:27:36 +0000 (15:27 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 24 Apr 2018 14:27:36 +0000 (15:27 +0100)
src/jalview/gui/PCAPanel.java

index 9f52d26..7ceceee 100644 (file)
@@ -464,7 +464,16 @@ public class PCAPanel extends GPCAPanel
     public void run()
     {
       PrinterJob printJob = PrinterJob.getPrinterJob();
-      PageFormat pf = printJob.pageDialog(printJob.defaultPage());
+      PageFormat defaultPage = printJob.defaultPage();
+      PageFormat pf = printJob.pageDialog(defaultPage);
+
+      if (defaultPage == pf)
+      {
+        /*
+         * user cancelled
+         */
+        return;
+      }
 
       printJob.setPrintable(this, pf);