本文整理匯總了Java中java.awt.print.PrinterException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java PrinterException.printStackTrace方法的具體用法?Java PrinterException.printStackTrace怎麽用?Java PrinterException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.print.PrinterException
的用法示例。
在下文中一共展示了PrinterException.printStackTrace方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initRootView
import java.awt.print.PrinterException; //導入方法依賴的package包/類
private void initRootView(final PageFormat pageFormat) {
pane.setSize((int) (pageFormat.getImageableWidth() / SCALE),
Integer.MAX_VALUE);
pane.validate();
rootView = pane.getUI().getRootView(pane);
pages.clear();
pageStartY = 0;
pageEndY = 0;
currentPage = -1;
this.pageFormat = pageFormat;
int pageIndex = 0;
try {
while (print(null, pageFormat, pageIndex) == PAGE_EXISTS)
pageIndex++;
} catch (final PrinterException e) {
e.printStackTrace();
}
}
示例2: printTest
import java.awt.print.PrinterException; //導入方法依賴的package包/類
private static void printTest() {
MediaTray tray = null;
//tray = getMediaTray( prservices, "Bypass Tray" );
tray = getMediaTray( prservices, "Tray 4" );
PrintRequestAttributeSet atrset = new HashPrintRequestAttributeSet();
//atrset.add( MediaSizeName.ISO_A4 );
atrset.add(tray);
PrinterJob pjob = PrinterJob.getPrinterJob();
pjob.setPrintable(new TestMediaTraySelection());
try {
pjob.print(atrset);
} catch (PrinterException e) {
e.printStackTrace();
fail();
}
}
示例3: actionPerformed
import java.awt.print.PrinterException; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {
try {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(testInstance);
if (job.printDialog()) {
job.print();
}
} catch (PrinterException ex) {
ex.printStackTrace();
}
}
示例4: actionPerformed
import java.awt.print.PrinterException; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(this);
if (job.printDialog()) {
try {
job.print();
} catch (PrinterException ex) {
ex.printStackTrace();
}
}
}
示例5: printTest
import java.awt.print.PrinterException; //導入方法依賴的package包/類
private static void printTest() {
job.setPrintable(new TestCheckSystemDefaultBannerOption());
try {
job.print();
} catch (PrinterException e) {
e.printStackTrace();
}
}
示例6: main
import java.awt.print.PrinterException; //導入方法依賴的package包/類
public static final void main( String[] parameters ) {
PrinterJob printjob = PrinterJob.getPrinterJob();
printjob.setJobName( "Test Print Job" );
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add( OrientationRequested.LANDSCAPE );
try {
printjob.setPrintable( new Painter() );
printjob.print( attributes );
} catch( PrinterException exception ) {
exception.printStackTrace();
}
}
示例7: printTest
import java.awt.print.PrinterException; //導入方法依賴的package包/類
private static void printTest() {
job.setPrintable(new BannerTest());
if(job.printDialog()) {
try {
job.print();
} catch (PrinterException e) {
e.printStackTrace();
fail();
}
}
}
示例8: printWorks
import java.awt.print.PrinterException; //導入方法依賴的package包/類
public void printWorks(String[] args)
{
PrinterJob job=PrinterJob.getPrinterJob();
job.setPrintable(this);
PrintRequestAttributeSet settings=new HashPrintRequestAttributeSet();
PrinterResolution pr = new PrinterResolution(300, 300, ResolutionSyntax.DPI);
if (args.length > 0 && (args[0].compareTo("600") == 0)) {
pr = new PrinterResolution(600, 600, ResolutionSyntax.DPI);
System.out.println("Adding 600 Dpi attribute");
} else {
System.out.println("Adding 300 Dpi attribute");
}
PrintService ps = job.getPrintService();
boolean resolutionSupported = ps.isAttributeValueSupported(pr, null, null);
System.out.println("Is "+pr+" supported by "+ps+"? "+resolutionSupported);
if (resolutionSupported) {
System.out.println("Resolution is supported.\nTest is not applicable, PASSED");
}
settings.add(pr);
if (args.length > 0 && (args[0].equalsIgnoreCase("fidelity"))) {
settings.add(Fidelity.FIDELITY_TRUE);
System.out.println("Adding Fidelity.FIDELITY_TRUE attribute");
}
if (job.printDialog(settings))
{
try {
job.print(settings);
} catch (PrinterException e) {
e.printStackTrace();
}
}
}