日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

java6打印机不能用_高分求解:java中调用的打印机在什么情况下不可用?

發布時間:2025/3/12 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java6打印机不能用_高分求解:java中调用的打印机在什么情况下不可用? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

java文檔中說PrinterJob類中的getPrinterJob()方法無論返回的打印機是否可用都不會返回一個null值。我查閱過一些文獻有介紹說可以用getPrintService()方法測試返回的數值是否為null來...

java文檔中說PrinterJob類中的getPrinterJob()方法無論返回的打印機是否可用都不會返回一個null值。我查閱過一些文獻有介紹說可以用getPrintService()方法測試返回的數值是否為null來判斷打印機是否可用。

但是我不明白的是,在什么情況下打印機不可用?高分求解詳細的解答。

java文檔參考原文:

PrinterJob java.awt.print.PrinterJob.getPrinterJob()

"

Creates and returns a PrinterJob which is initially associated with the default printer. If no printers are available on the system, a PrinterJob will still be returned from this method, but getPrintService() will return null, and calling print with this PrinterJob might generate an exception. Applications that need to determine if there are suitable printers before creating a PrinterJob should ensure that the array returned from lookupPrintServices is not empty.

"

相關文檔原文參考:

"

One point you should keep in mind is that sometimes a printer may not be available on the machine on which your code is running.In this case the getPrintService() method will return null,so it's a good idea to call the method and test the reference that is returned,even if you don't want to obtain details of the printer.

"

請排除打印機損壞的情況。

展開

總結

以上是生活随笔為你收集整理的java6打印机不能用_高分求解:java中调用的打印机在什么情况下不可用?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。