From 844c332f108aba635608f13dedf2b08777b3a477 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 23 Mar 2017 15:10:52 +0000 Subject: [PATCH] JAL-2464 fix cancel tree print behaviour --- src/jalview/gui/TreeCanvas.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 54eed1a..9a38d4c 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -549,7 +549,16 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, 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); -- 1.7.10.2