/** print the canvas scaled with factor <code>scale</code> */ public void print(double scale) { printScale = scale; PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(this); if (printJob.printDialog()) { try { printJob.print(); } catch (Exception ex) { ex.printStackTrace(); } } }
public void actionPerformed(ActionEvent e) { PrinterJob pj = PrinterJob.getPrinterJob(); if (pj != null && pj.printDialog()) { pj.setPrintable(c); try { pj.print(); } catch (PrinterException pe) { } finally { System.err.println("PRINT RETURNED"); } } }