PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(new HelloNursePrintable()); if (pj.printDialog()) { try { pj.print(); } catch (PrinterException e) { System.out.println(e); } }