Java examples for 2D Graphics:Print
Listening for Print Job Status Changes
import javax.print.DocPrintJob; import javax.print.event.PrintJobEvent; import javax.print.event.PrintJobListener; public class Main { public void m() throws Exception { // Create the print job DocPrintJob job = null;//from w ww . j ava 2 s . c o m job.addPrintJobListener(new MyPrintJobListener()); } class MyPrintJobListener implements PrintJobListener { public void printDataTransferCompleted(PrintJobEvent pje) { // The print data has been transferred to the print service } public void printJobCanceled(PrintJobEvent pje) { // The print job was cancelled } public void printJobCompleted(PrintJobEvent pje) { // The print job was completed } public void printJobFailed(PrintJobEvent pje) { // The print job has failed } public void printJobNoMoreEvents(PrintJobEvent pje) { } public void printJobRequiresAttention(PrintJobEvent pje) { } } }