Example usage for java.awt PrintJob lastPageFirst

List of usage examples for java.awt PrintJob lastPageFirst

Introduction

In this page you can find the example usage for java.awt PrintJob lastPageFirst.

Prototype

public abstract boolean lastPageFirst();

Source Link

Document

Returns true if the last page will be printed first.

Usage

From source file:PrintTestApp.java

public PrintTestApp() {
    super("PrintTestApp");
    toolkit = getToolkit();/*from ww  w. ja  v a  2 s.c om*/
    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();
    }
}