Handler for File → Print.
()
| 2475 | * Handler for File → Print. |
| 2476 | */ |
| 2477 | private void handlePrint() { |
| 2478 | statusNotice(tr("Printing...")); |
| 2479 | //printerJob = null; |
| 2480 | PrinterJob printerJob = PrinterJob.getPrinterJob(); |
| 2481 | if (pageFormat != null) { |
| 2482 | //System.out.println("setting page format " + pageFormat); |
| 2483 | printerJob.setPrintable(getCurrentTab().getTextArea(), pageFormat); |
| 2484 | } else { |
| 2485 | printerJob.setPrintable(getCurrentTab().getTextArea()); |
| 2486 | } |
| 2487 | // set the name of the job to the code name |
| 2488 | printerJob.setJobName(getCurrentTab().getSketchFile().getPrettyName()); |
| 2489 | |
| 2490 | if (printerJob.printDialog()) { |
| 2491 | try { |
| 2492 | printerJob.print(); |
| 2493 | statusNotice(tr("Done printing.")); |
| 2494 | |
| 2495 | } catch (PrinterException pe) { |
| 2496 | statusError(tr("Error while printing.")); |
| 2497 | pe.printStackTrace(); |
| 2498 | } |
| 2499 | } else { |
| 2500 | statusNotice(tr("Printing canceled.")); |
| 2501 | } |
| 2502 | //printerJob = null; // clear this out? |
| 2503 | } |
| 2504 | |
| 2505 | |
| 2506 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
no test coverage detected