本文整理匯總了Java中javax.print.PrintService.createPrintJob方法的典型用法代碼示例。如果您正苦於以下問題:Java PrintService.createPrintJob方法的具體用法?Java PrintService.createPrintJob怎麽用?Java PrintService.createPrintJob使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.print.PrintService
的用法示例。
在下文中一共展示了PrintService.createPrintJob方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showPrintJDialog
import javax.print.PrintService; //導入方法依賴的package包/類
final public Boolean showPrintJDialog() {
final PrintService objLdefaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
final PrintRequestAttributeSet objLprintRequestAttributeSet = new HashPrintRequestAttributeSet();
if (this.objGprintServiceA.length > 0) {
int intLdefaultServiceIndex = 0;
if (objLdefaultPrintService != null) {
for (intLdefaultServiceIndex = 0; intLdefaultServiceIndex < this.objGprintServiceA.length; intLdefaultServiceIndex++) {
if (this.objGprintServiceA[intLdefaultServiceIndex].equals(objLdefaultPrintService)) {
break;
}
}
}
if (intLdefaultServiceIndex == this.objGprintServiceA.length) {
intLdefaultServiceIndex = 0;
}
ServiceUI.printDialog( null,
50,
50,
this.objGprintServiceA,
this.objGprintServiceA[intLdefaultServiceIndex],
null,
objLprintRequestAttributeSet);
final PrintJDialog objLprintJDialog = new PrintJDialog(this.objGcontrolJFrame, this.objGprintServiceA, intLdefaultServiceIndex);
objLprintJDialog.setVisible();
final PrintService objLprintService = objLprintJDialog.getPrintService();
objLprintJDialog.dispose();
if (objLprintService != null) {
final DocPrintJob objLdocPrintJob = objLprintService.createPrintJob();
final SimpleDoc objLsimpleDoc = new SimpleDoc(this, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
try {
objLdocPrintJob.print(objLsimpleDoc, objLprintRequestAttributeSet);
return new Boolean(true);
} catch (final Throwable objPthrowable) {}
} else {
return null;
}
} else {
new PopUpJDialog( this.objGcontrolJFrame,
Constants.bytS_UNCLASS_NO_VALUE,
Constants.intS_FILE_ICON_ALERT,
this.objGcontrolJFrame.getLanguageString(Language.intS_TITLE_PRINT_PATTERN),
Tools.getLocaleString("dialog.noprintermsg"),
null,
true);
}
return new Boolean(false);
}