List of usage examples for java.awt PrintJob end
public abstract void end();
From source file:MainClass.java
public static void main(String args[]) { String name = "Test print job"; Properties properties = new Properties(); PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(new MainClass(), name, properties); if (pj != null) { printDimensions(pj.getGraphics(), pj.getPageDimension()); pj.end(); }/*from ww w .j a v a2s .com*/ }
From source file:PrintSampleApp.java
public PrintSampleApp() { add("Center", canvas); setSize(500, 500);/*from w w w . ja va 2 s . co m*/ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); String name = "Test print job"; Properties properties = new Properties(); PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(PrintSampleApp.this, name, properties); if (pj != null) { canvas.printAll(pj.getGraphics()); pj.end(); } }
From source file:PrintTestApp.java
public PrintTestApp() { super("PrintTestApp"); toolkit = getToolkit();/*from w w w . jav a 2 s. c o m*/ add("Center", textArea); setSize(300, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); String name = "Test print job"; Properties properties = new Properties(); PrintJob pj = toolkit.getPrintJob(PrintTestApp.this, name, properties); if (pj == null) textArea.setText("A null PrintJob was returned."); else { String output = "Name: " + name + "\nProperties: " + properties.toString(); Dimension pageDim = pj.getPageDimension(); int resolution = pj.getPageResolution(); boolean lastPageFirst = pj.lastPageFirst(); output += "\nPage dimension (in pixels):"; output += "\n height: " + String.valueOf(pageDim.height); output += "\n width: " + String.valueOf(pageDim.width); output += "\nResolution (pixels/inch): " + String.valueOf(resolution); output += "\nLast Page First: " + String.valueOf(lastPageFirst); textArea.setText(output); Graphics g = pj.getGraphics(); g.dispose(); pj.end(); } }