try{
PrintService[] svc;
PrintService defService = PrintServiceLookup.lookupDefaultPrintService(); if (defService == null) {
svc = PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); if (svc.length == 0) { thrownew RuntimeException("Printer is required for this test. TEST ABORTED");
}
defService = svc[0];
}
System.out.println("PrintService found : "+defService);
pj = PrinterJob.getPrinterJob();
pj.setPrintService(defService); //pj.setPrintable(this); // commenting this line should not result in PrinterException
pj.print();
} catch(PrinterException e ) {
e.printStackTrace(); thrownew RuntimeException(" PrinterException should not be thrown. TEST FAILED");
}
System.out.println("TEST PASSED");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.