本文整理汇总了Java中javax.print.PrintService.isAttributeCategorySupported方法的典型用法代码示例。如果您正苦于以下问题:Java PrintService.isAttributeCategorySupported方法的具体用法?Java PrintService.isAttributeCategorySupported怎么用?Java PrintService.isAttributeCategorySupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.print.PrintService
的用法示例。
在下文中一共展示了PrintService.isAttributeCategorySupported方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.print.PrintService; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
job = PrinterJob.getPrinterJob();
PrintService prtSrv = job.getPrintService();
if (job.getPrintService() == null) {
System.out.println("No printers. Test cannot continue");
return;
}
if (!prtSrv.isAttributeCategorySupported(JobSheets.class)) {
return;
}
SwingUtilities.invokeAndWait(() -> {
doTest(BannerTest::printTest);
});
mainThread = Thread.currentThread();
try {
Thread.sleep(180000);
} catch (InterruptedException e) {
if (!testPassed && testGeneratedInterrupt) {
throw new RuntimeException("Banner page did not print");
}
}
if (!testGeneratedInterrupt) {
throw new RuntimeException("user has not executed the test");
}
}
示例2: main
import javax.print.PrintService; //导入方法依赖的package包/类
public static void main (String[] args) throws Exception {
job = PrinterJob.getPrinterJob();
PrintService prtSrv = job.getPrintService();
if (prtSrv == null) {
System.out.println("No printers. Test cannot continue");
return;
}
// do not run the test if JobSheet category is not supported
if (!prtSrv.isAttributeCategorySupported(JobSheets.class)) {
return;
}
// check system default banner option and let user know what to expect
JobSheets js = (JobSheets)job.getPrintService().
getDefaultAttributeValue(JobSheets.class);
if (js != null && js.equals(JobSheets.NONE)) {
noJobSheet = true;
}
SwingUtilities.invokeAndWait(() -> {
doTest(TestCheckSystemDefaultBannerOption::printTest);
});
mainThread = Thread.currentThread();
try {
Thread.sleep(60000);
} catch (InterruptedException e) {
if (!testPassed && testGeneratedInterrupt) {
String banner = noJobSheet ? "Banner page" : " No Banner page";
throw new RuntimeException(banner + " is printed");
}
}
if (!testGeneratedInterrupt) {
throw new RuntimeException("user has not executed the test");
}
}