Всем привет. Сразу скажу что не JAVA-программист поэтому прошу сильно не пинать. Есть код :
class Print1 {
public void PrintJobManagment(DocPrintJob job) {
// Add a listener to the print job
job.addPrintJobListener(new PrintJobAdapter() {
private int iResult;
@Override
public void printDataTransferCompleted(PrintJobEvent pje) {
// The print data has been transferred to the print service
System.out.println("-> 1");
}
@Override
public void printJobCanceled(PrintJobEvent pje) {
// The print job was cancelled
System.out.println("-> 2");
setStatus(2);
}
@Override
public void printJobCompleted(PrintJobEvent pje) {
// The print job was completed
System.out.println("-> 3");
setStatus(3);
}
@Override
public void printJobFailed(PrintJobEvent pje) {
System.out.println("-> 4");
setStatus(4);
}
@Override
public void printJobNoMoreEvents(PrintJobEvent pje) {
System.out.println("-> 5");
setStatus(5);
}
@Override
public void printJobRequiresAttention(PrintJobEvent pje) {
System.out.println("-> 6");
setStatus(6);
}
void setStatus(int iStatus) {
synchronized(Print1.this){
iResult = iStatus;
System.out.println("IRESULT: " + iStatus);
Print1.this.notify();
}
}
});
}
public static void main(String[] argc) {
}
}