PrinterJob pJ = PrinterJob.createPrinterJob();
if (pJ != null) {
boolean success = pJ.printPage(some-node);
if (success) {
pJ.endJob();
}
}
This prints to the default printer without showing any dialog to the user. To use a printer other than the default you can use the PrinterJob#createPrinterJob(Printer)
to set the current printer. You can use this to view all printers on your system:
System.out.println(Printer.getAllPrinters());