本文整理汇总了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);
}