當前位置: 首頁>>代碼示例>>Java>>正文


Java PrinterException.printStackTrace方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:20,代碼來源:HTMLPrintable.java

示例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();
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:TestMediaTraySelection.java

示例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();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:PrintLatinCJKTest.java

示例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();
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:bug8023392.java

示例5: printTest

import java.awt.print.PrinterException; //導入方法依賴的package包/類
private static void printTest() {
    job.setPrintable(new TestCheckSystemDefaultBannerOption());
    try {
        job.print();
    } catch (PrinterException e) {
        e.printStackTrace();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:TestCheckSystemDefaultBannerOption.java

示例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();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:LandscapeStackOverflow.java

示例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();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:BannerTest.java

示例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();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:34,代碼來源:TestUnsupportedResolution.java


注:本文中的java.awt.print.PrinterException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。