本文整理匯總了Java中javax.print.PrintService.getDefaultAttributeValue方法的典型用法代碼示例。如果您正苦於以下問題:Java PrintService.getDefaultAttributeValue方法的具體用法?Java PrintService.getDefaultAttributeValue怎麽用?Java PrintService.getDefaultAttributeValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.print.PrintService
的用法示例。
在下文中一共展示了PrintService.getDefaultAttributeValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: pageableJob
import javax.print.PrintService; //導入方法依賴的package包/類
public void pageableJob(Pageable pageable) throws PrintException {
try {
synchronized(this) {
if (job != null) { // shouldn't happen
throw new PrintException("already printing");
} else {
job = new sun.awt.windows.WPrinterJob();
}
}
PrintService svc = getPrintService();
job.setPrintService(svc);
if (copies == 0) {
Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
copies = c.getValue();
}
job.setCopies(copies);
job.setJobName(jobName);
job.setPageable(pageable);
job.print(reqAttrSet);
notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
return;
} catch (PrinterException pe) {
notifyEvent(PrintJobEvent.JOB_FAILED);
throw new PrintException(pe);
} finally {
printReturned = true;
notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
}
}
示例2: UnixPrintJob
import javax.print.PrintService; //導入方法依賴的package包/類
UnixPrintJob(PrintService service) {
this.service = service;
mDestination = service.getName();
if (PrintServiceLookupProvider.isMac()) {
mDestination = ((IPPPrintService)service).getDest();
}
mDestType = UnixPrintJob.DESTPRINTER;
JobSheets js = (JobSheets)(service.
getDefaultAttributeValue(JobSheets.class));
if (js != null && js.equals(JobSheets.NONE)) {
mNoJobSheet = true;
}
}