Example usage for java.awt.print Printable interface-usage

List of usage examples for java.awt.print Printable interface-usage

Introduction

In this page you can find the example usage for java.awt.print Printable interface-usage.

Usage

From source file BasicPrint.java

public class BasicPrint extends JComponent implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {

        double x = 0;
        double y = 0;
        double w = pf.getWidth();

From source file BasicPrint.java

public class BasicPrint extends JComponent implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {

        double ix = pf.getImageableX();
        double iy = pf.getImageableY();
        double iw = pf.getImageableWidth();

From source file BasicPrint.java

public class BasicPrint extends JComponent implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {
        if (pageIndex > 0) {
            return Printable.NO_SUCH_PAGE;
        }
        Graphics2D g2d = (Graphics2D) g;

From source file Main.java

public class Main implements Printable {
    private static Font sFont = new Font("Serif", Font.PLAIN, 64);

    public int print(Graphics g, PageFormat Pf, int pageIndex) throws PrinterException {
        if (pageIndex > 0)
            return NO_SUCH_PAGE;

From source file JavaWorldPrintExample1.java

public class JavaWorldPrintExample1 implements Printable {
    public static void main(String[] args) {

        JavaWorldPrintExample1 example1 = new JavaWorldPrintExample1();
        System.exit(0);
    }

From source file PrintableComponent.java

/**
 * This wrapper class encapsulates a Component and allows it to be printed
 * using the Java 2 printing API.
 */
public class PrintableComponent implements Printable {
    // The component to be printed.

From source file ImagePrint.java

class MyPrintable implements Printable {
    ImageIcon printImage = new javax.swing.ImageIcon("a.gif");

    public int print(Graphics g, PageFormat pf, int pageIndex) {
        Graphics2D g2d = (Graphics2D) g;
        g.translate((int) (pf.getImageableX()), (int) (pf.getImageableY()));

From source file PrintBook.java

class Printable1 implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {
        drawGraphics(g, pf);
        return Printable.PAGE_EXISTS;
    }

From source file MainClass.java

class PrintDemo1 implements Printable {

    public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
        // pageIndex 0 corresponds to page number 1.
        if (pageIndex >= 1)
            return Printable.NO_SUCH_PAGE;

From source file MainClass.java

class MyPrintable implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {
        if (pageIndex != 0)
            return NO_SUCH_PAGE;
        Graphics2D g2 = (Graphics2D) g;
        g2.setFont(new Font("Serif", Font.PLAIN, 36));