这个压缩包里的都是超级经典的java例子
源代码在线查看: jobdone.htm
Listening for Print Job Status Changes (Java Developers Almanac Example)
The Java Developers Almanac 1.4
Order this book from Amazon.
google_ad_client = "pub-6001183370374757";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel = "4777242811";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "6666CC";
google_color_url = "6666CC";
google_color_text = "000000";
//-->
Home
>
List of Packages
>
javax.print.event
[3 examples]
e714. Listening for Print Job Status Changes
In order to get status on a print job,
a print job listener must be added to the
print job before it is submitted to the print service.
These status changes are common to all print jobs.
A print service may support other types of print job
status changes and these are delivered through a
print job attribute listener rather than a print job listener;
see e715 Listening for Print Job Attribute Changes.
// Create the print job
DocPrintJob job = service.createPrintJob();
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) {
// No more events will be delivered from this
// print service for this print job.
// This event is fired in cases where the print service
// is not able to determine when the job completes.
}
public void printJobRequiresAttention(PrintJobEvent pje) {
// The print service requires some attention to repair
// some problem. E.g. running out of paper would
// cause this event to be fired.
}
}
Related Examples
e713.
Listening for Print Service Status Changes
e715.
Listening for Print Job Attribute Changes
© 2002 Addison-Wesley.