本文整理汇总了Java中sun.print.Win32PrintServiceLookup类的典型用法代码示例。如果您正苦于以下问题:Java Win32PrintServiceLookup类的具体用法?Java Win32PrintServiceLookup怎么用?Java Win32PrintServiceLookup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Win32PrintServiceLookup类属于sun.print包,在下文中一共展示了Win32PrintServiceLookup类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrintService
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
public PrintService getPrintService() {
if (myService == null) {
String printerName = getNativePrintService();
if (printerName != null) {
myService = Win32PrintServiceLookup.getWin32PrintLUS().
getPrintServiceByName(printerName);
// no need to call setNativePrintService as this name is
// currently set in native
if (myService != null) {
return myService;
}
}
myService = PrintServiceLookup.lookupDefaultPrintService();
if (myService != null) {
try {
setNativePrintService(myService.getName());
} catch (Exception e) {
myService = null;
}
}
}
return myService;
}
示例2: getPrintService
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
public PrintService getPrintService() {
if (myService == null) {
String printerName = getNativePrintService();
if (printerName != null) {
myService = Win32PrintServiceLookup.getWin32PrintLUS().
getPrintServiceByName(printerName);
// no need to call setNativePrintService as this name is
// currently set in native
if (myService != null) {
return myService;
}
}
myService = PrintServiceLookup.lookupDefaultPrintService();
if (myService instanceof Win32PrintService) {
try {
setNativePrintServiceIfNeeded(myService.getName());
} catch (Exception e) {
myService = null;
}
}
}
return myService;
}
示例3: getPrintService
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
public PrintService getPrintService() {
if (myService == null) {
String printerName = getNativePrintService();
if (printerName != null) {
myService = Win32PrintServiceLookup.getWin32PrintLUS().
getPrintServiceByName(printerName);
// no need to call setNativePrintService as this name is
// currently set in native
if (myService != null) {
return myService;
}
}
myService = PrintServiceLookup.lookupDefaultPrintService();
if (myService != null) {
try {
setNativePrintServiceIfNeeded(myService.getName());
} catch (Exception e) {
myService = null;
}
}
}
return myService;
}
示例4: getPrintService
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
@Override
public PrintService getPrintService() {
if (myService == null) {
String printerName = getNativePrintService();
if (printerName != null) {
myService = Win32PrintServiceLookup.getWin32PrintLUS().
getPrintServiceByName(printerName);
// no need to call setNativePrintService as this name is
// currently set in native
if (myService != null) {
return myService;
}
}
myService = PrintServiceLookup.lookupDefaultPrintService();
if (myService instanceof Win32PrintService) {
try {
setNativePrintServiceIfNeeded(myService.getName());
} catch (Exception e) {
myService = null;
}
}
}
return myService;
}
示例5: pageDialog
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
/**
* Display a dialog to the user allowing the modification of a
* PageFormat instance.
* The <code>page</code> argument is used to initialize controls
* in the page setup dialog.
* If the user cancels the dialog, then the method returns the
* original <code>page</code> object unmodified.
* If the user okays the dialog then the method returns a new
* PageFormat object with the indicated changes.
* In either case the original <code>page</code> object will
* not be modified.
* @param page the default PageFormat presented to the user
* for modification
* @return the original <code>page</code> object if the dialog
* is cancelled, or a new PageFormat object containing
* the format indicated by the user if the dialog is
* acknowledged
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
* @since JDK1.2
*/
@Override
public PageFormat pageDialog(PageFormat page) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
if (!(getPrintService() instanceof Win32PrintService)) {
return super.pageDialog(page);
}
PageFormat pageClone = (PageFormat) page.clone();
boolean result = false;
/*
* Fix for 4507585: show the native modal dialog the same way printDialog() does so
* that it won't block event dispatching when called on EventDispatchThread.
*/
WPageDialog dialog = new WPageDialog((Frame)null, this,
pageClone, null);
dialog.setRetVal(false);
dialog.setVisible(true);
result = dialog.getRetVal();
dialog.dispose();
// myService => current PrintService
if (result && (myService != null)) {
// It's possible that current printer is changed through
// the "Printer..." button so we query again from native.
String printerName = getNativePrintService();
if (!myService.getName().equals(printerName)) {
// native printer is different !
// we update the current PrintService
try {
setPrintService(Win32PrintServiceLookup.
getWin32PrintLUS().
getPrintServiceByName(printerName));
} catch (PrinterException e) {
}
}
// Update attributes, this will preserve the page settings.
// - same code as in RasterPrinterJob.java
updatePageAttributes(myService, pageClone);
return pageClone;
} else {
return page;
}
}
示例6: pageDialog
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
/**
* Display a dialog to the user allowing the modification of a
* PageFormat instance.
* The <code>page</code> argument is used to initialize controls
* in the page setup dialog.
* If the user cancels the dialog, then the method returns the
* original <code>page</code> object unmodified.
* If the user okays the dialog then the method returns a new
* PageFormat object with the indicated changes.
* In either case the original <code>page</code> object will
* not be modified.
* @param page the default PageFormat presented to the user
* for modification
* @return the original <code>page</code> object if the dialog
* is cancelled, or a new PageFormat object containing
* the format indicated by the user if the dialog is
* acknowledged
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
* @since JDK1.2
*/
public PageFormat pageDialog(PageFormat page) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
if (getPrintService() instanceof StreamPrintService) {
return super.pageDialog(page);
}
PageFormat pageClone = (PageFormat) page.clone();
boolean result = false;
/*
* Fix for 4507585: show the native modal dialog the same way printDialog() does so
* that it won't block event dispatching when called on EventDispatchThread.
*/
WPageDialog dialog = new WPageDialog((Frame)null, this,
pageClone, null);
dialog.setRetVal(false);
dialog.setVisible(true);
result = dialog.getRetVal();
dialog.dispose();
// myService => current PrintService
if (result && (myService != null)) {
// It's possible that current printer is changed through
// the "Printer..." button so we query again from native.
String printerName = getNativePrintService();
if (!myService.getName().equals(printerName)) {
// native printer is different !
// we update the current PrintService
try {
setPrintService(Win32PrintServiceLookup.
getWin32PrintLUS().
getPrintServiceByName(printerName));
} catch (PrinterException e) {
}
}
// Update attributes, this will preserve the page settings.
// - same code as in RasterPrinterJob.java
updatePageAttributes(myService, pageClone);
return pageClone;
} else {
return page;
}
}
示例7: pageDialog
import sun.print.Win32PrintServiceLookup; //导入依赖的package包/类
/**
* Display a dialog to the user allowing the modification of a
* PageFormat instance.
* The <code>page</code> argument is used to initialize controls
* in the page setup dialog.
* If the user cancels the dialog, then the method returns the
* original <code>page</code> object unmodified.
* If the user okays the dialog then the method returns a new
* PageFormat object with the indicated changes.
* In either case the original <code>page</code> object will
* not be modified.
* @param page the default PageFormat presented to the user
* for modification
* @return the original <code>page</code> object if the dialog
* is cancelled, or a new PageFormat object containing
* the format indicated by the user if the dialog is
* acknowledged
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
* @since JDK1.2
*/
public PageFormat pageDialog(PageFormat page) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
if (!(getPrintService() instanceof Win32PrintService)) {
return super.pageDialog(page);
}
PageFormat pageClone = (PageFormat) page.clone();
boolean result = false;
/*
* Fix for 4507585: show the native modal dialog the same way printDialog() does so
* that it won't block event dispatching when called on EventDispatchThread.
*/
WPageDialog dialog = new WPageDialog((Frame)null, this,
pageClone, null);
dialog.setRetVal(false);
dialog.setVisible(true);
result = dialog.getRetVal();
dialog.dispose();
// myService => current PrintService
if (result && (myService != null)) {
// It's possible that current printer is changed through
// the "Printer..." button so we query again from native.
String printerName = getNativePrintService();
if (!myService.getName().equals(printerName)) {
// native printer is different !
// we update the current PrintService
try {
setPrintService(Win32PrintServiceLookup.
getWin32PrintLUS().
getPrintServiceByName(printerName));
} catch (PrinterException e) {
}
}
// Update attributes, this will preserve the page settings.
// - same code as in RasterPrinterJob.java
updatePageAttributes(myService, pageClone);
return pageClone;
} else {
return page;
}
}