Java 类java.awt.PrintJob 实例源码

项目:openjdk-jdk10    文件:JobAttrUpdateTest.java   
private static void printTest() {
    JobAttributes ja = new JobAttributes();

    Toolkit tk = Toolkit.getDefaultToolkit();
    // ja.setToPage(4);
    // ja.setFromPage(3);
    // show dialog
    PrintJob pjob = tk.getPrintJob(new JFrame(), "test", ja, null);
    if (pjob == null) {
        return;
    }


    if (ja.getDefaultSelection() == JobAttributes.DefaultSelectionType.RANGE) {
        int fromPage = ja.getFromPage();
        int toPage = ja.getToPage();
        if (fromPage != 2 || toPage != 3) {
            fail();
        } else {
            pass();
        }
    }
}
项目:openjdk9    文件:PrinterException.java   
public static void main(String[] args) {
    Toolkit tk = Toolkit.getDefaultToolkit();
    PrintJob pj = null;

    int[][] pageRange = new int[][]{new int[]{1,1}};
    JobAttributes ja = new JobAttributes(1,
            java.awt.JobAttributes.DefaultSelectionType.ALL,
            JobAttributes.DestinationType.FILE, JobAttributes.DialogType.NATIVE,
            "", Integer.MAX_VALUE, 1,
            JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
             pageRange, "", JobAttributes.SidesType.ONE_SIDED);
    Frame testFrame = new Frame("print");
    if (tk != null) {
        pj = tk.getPrintJob(testFrame, null, ja, null);
    }
}
项目:openjdk9    文件:JobAttrUpdateTest.java   
private static void printTest() {
    JobAttributes ja = new JobAttributes();

    Toolkit tk = Toolkit.getDefaultToolkit();
    // ja.setToPage(4);
    // ja.setFromPage(3);
    // show dialog
    PrintJob pjob = tk.getPrintJob(new JFrame(), "test", ja, null);
    if (pjob == null) {
        return;
    }


    if (ja.getDefaultSelection() == JobAttributes.DefaultSelectionType.RANGE) {
        int fromPage = ja.getFromPage();
        int toPage = ja.getToPage();
        if (fromPage != 2 || toPage != 3) {
            fail();
        } else {
            pass();
        }
    }
}
项目:fern    文件:ContourFrame.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);                      // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {                           // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();

    }
项目:fern    文件:IsoData.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);     // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {           // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();
    }
项目:fern    文件:PlotParams.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);     // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {           // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();

    }
项目:fern    文件:SegreFrame.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);          // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {                // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);

        g.dispose();
        job.end();
    }
项目:fern    文件:RatePlotFrame.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);     // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {           // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();

    }
项目:fern    文件:ContourFrameFlux.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);                      // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {                           // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();

    }
项目:fern    文件:ParamSetup.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);     // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {           // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();
    }
项目:fern    文件:AbPlotFrame.java   
public void printThisFrame(int xoff, int yoff, boolean makeBorder) {

        java.util.Properties printprefs = new java.util.Properties();
        Toolkit toolkit = this.getToolkit();
        PrintJob job = toolkit.getPrintJob(this,"Java Print",printprefs);
        if (job == null) {return;}
        Graphics g = job.getGraphics();
        g.translate(xoff,yoff);          // Offset from upper left corner
        Dimension size = this.getSize();
        if (makeBorder) {               // Rectangular border
            g.drawRect(-1,-1,size.width+2,size.height+2);
        }
        g.setClip(0,0,size.width,size.height);
        this.printAll(g);
        g.dispose();
        job.end();

    }
项目:paint    文件:Util.java   
/**
 * Function for printing image.
 * 
 * @param _pic instance of Picture that is printed.
 */
public static void print(final Picture _pic) {

    BufferedImage bi_pic = _pic.calculateImage();
JFrame jf = new JFrame();
    jf.setSize(
            (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight()
            * bi_pic.getWidth()  / bi_pic.getHeight(),
            (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight());
    jf.setVisible(false);
    PrintJob pjob = Toolkit.getDefaultToolkit().getPrintJob(
            jf, "paintPrint", null);
    if (pjob != null) {
          Graphics pg = pjob.getGraphics();
          if (pg != null) {
              bi_pic = resize(bi_pic, jf.getWidth(), jf.getHeight());
              pg.drawImage(bi_pic, 0, 0, null);
              pg.dispose();
          }
          pjob.end();
        }
    jf.dispose();
}
项目:openjdk-jdk10    文件:PrinterException.java   
public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    Thread t = new Thread (() -> {
        robot.waitForIdle();
        robot.delay(2000);
        robot.keyPress(KeyEvent.VK_ESCAPE);
        robot.keyRelease(KeyEvent.VK_ESCAPE);
       });
    Toolkit tk = Toolkit.getDefaultToolkit();
    PrintJob pj = null;

    int[][] pageRange = new int[][]{new int[]{1,1}};
    JobAttributes ja = new JobAttributes(1,
            java.awt.JobAttributes.DefaultSelectionType.ALL,
            JobAttributes.DestinationType.FILE, JobAttributes.DialogType.NATIVE,
            "filename.ps", Integer.MAX_VALUE, 1,
            JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
             pageRange, "", JobAttributes.SidesType.ONE_SIDED);

    Frame testFrame = new Frame("print");
    try {
        if (tk != null) {
            t.start();
            pj = tk.getPrintJob(testFrame, null, ja, null);
        }
    } finally {
        testFrame.dispose();
    }
}
项目:openjdk-jdk10    文件:PrintTest.java   
private static void printTest() {
    JobAttributes job = new JobAttributes();
    PageAttributes page = new PageAttributes();
    job.setDialog(JobAttributes.DialogType.NATIVE);
    job.setDefaultSelection(JobAttributes.DefaultSelectionType.ALL);
    job.setFromPage(2);
    job.setToPage(5);
    Toolkit tk = Toolkit.getDefaultToolkit();
    // setting this dialog to native printdialog
    if (tk != null) {
        PrintJob pj = tk.getPrintJob(new JFrame(),
                      "testing the attribute setting ", job, page);
    }
}
项目:openjdk9    文件:PrintTest.java   
private static void printTest() {
    JobAttributes job = new JobAttributes();
    PageAttributes page = new PageAttributes();
    job.setDialog(JobAttributes.DialogType.NATIVE);
    job.setDefaultSelection(JobAttributes.DefaultSelectionType.ALL);
    job.setFromPage(2);
    job.setToPage(5);
    Toolkit tk = Toolkit.getDefaultToolkit();
    // setting this dialog to native printdialog
    if (tk != null) {
        PrintJob pj = tk.getPrintJob(new JFrame(),
                      "testing the attribute setting ", job, page);
    }
}
项目:javify    文件:GtkToolkit.java   
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  return null;
}
项目:javify    文件:QtToolkit.java   
public PrintJob getPrintJob(Frame frame,
                            String jobtitle,
                            Properties props)
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  throw new RuntimeException("Not implemented");
}
项目:jvm-stm    文件:GtkToolkit.java   
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) 
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  return null;
}
项目:jvm-stm    文件:QtToolkit.java   
public PrintJob getPrintJob(Frame frame,
          String jobtitle,
          Properties props)
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  throw new RuntimeException("Not implemented");
}
项目:JamVM-PH    文件:GtkToolkit.java   
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) 
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  return null;
}
项目:JamVM-PH    文件:QtToolkit.java   
public PrintJob getPrintJob(Frame frame,
          String jobtitle,
          Properties props)
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  throw new RuntimeException("Not implemented");
}
项目:jif    文件:Utils.java   
/**
 * Print Inform document
 */
public void printInform(jFrame jframe, String title, JTextComponent jif) {
    Properties prop = new Properties();
    PrintJob pjob = jframe.getToolkit().getPrintJob(jframe, title, prop);
    if (pjob != null) {
        Graphics pg = pjob.getGraphics();
        if (pg != null) {
            String s = jif.getText();
            printLongString(pjob, pg, s);
            pg.dispose();
        }
        pjob.end();
    }
}
项目:classpath    文件:GtkToolkit.java   
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  return null;
}
项目:classpath    文件:QtToolkit.java   
public PrintJob getPrintJob(Frame frame,
                            String jobtitle,
                            Properties props)
{
  SecurityManager sm;
  sm = System.getSecurityManager();
  if (sm != null)
    sm.checkPrintJobAccess();

  throw new RuntimeException("Not implemented");
}
项目:incubator-netbeans    文件:UtilitiesTest.java   
public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) {
    return Toolkit.getDefaultToolkit().getPrintJob( frame, jobtitle, props );
}
项目:OpenJSharp    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:jdk8u-jdk    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:openjdk-jdk10    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:openjdk9    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:jdk8u_jdk    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:lookaside_java-1.8.0-openjdk    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:javify    文件:XToolkit.java   
public PrintJob getPrintJob(Frame frame, String title, Properties props)
{
  // TODO: Implement this.
  throw new UnsupportedOperationException("Not yet implemented.");
}
项目:javify    文件:HeadlessToolkit.java   
public PrintJob getPrintJob(Frame frame, String title, Properties props)
{
  // TODO Auto-generated method stub
  return null;
}
项目:jvm-stm    文件:XToolkit.java   
public PrintJob getPrintJob(Frame frame, String title, Properties props)
{
  // TODO: Implement this.
  throw new UnsupportedOperationException("Not yet implemented.");
}
项目:jvm-stm    文件:HeadlessToolkit.java   
public PrintJob getPrintJob(Frame frame, String title, Properties props)
{
  // TODO Auto-generated method stub
  return null;
}
项目:fern    文件:StochasticElements.java   
public static void print() {

        ContourPlotter p = new ContourPlotter();
        Toolkit toolkit = p.getToolkit();
        PrintJob job = toolkit.getPrintJob(p, "nzPlane", printprefs);

        if (job == null) return;

        Graphics page = job.getGraphics();

        Dimension size = p.getSize();

        Dimension pagesize = job.getPageDimension();
        page.translate((pagesize.width - 700) / 2, (pagesize.height - 650) / 2);
        page.drawRect(1, 1, 700, 650);
        p.print(page);

        page.dispose();
        job.end();

    }
项目:infobip-open-jdk-8    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:jdk8u-dev-jdk    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:jdk7-jdk    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}
项目:openjdk-source-code-learn    文件:ProxyPrintGraphics.java   
public ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob) {
    super(graphics);
    printJob = thePrintJob;
}