本文整理匯總了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");
}
}