Java Reference
In-Depth Information
Figure 12−1. Demonstration page printed by HardcopyWriter
Example 12−3: HardcopyWriter.java
package com.davidflanagan.examples.print;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.text.*;
import java.util.*;
/**
* A character output stream that sends output to a printer.
**/
public class HardcopyWriter extends Writer {
// These are the instance variables for the class
protected PrintJob job;
// The PrintJob object in use
protected Graphics page;
// Graphics object for current page
protected String jobname;
// The name of the print job
protected int fontsize;
// Point size of the font
protected String time;
// Current time (appears in header)
protected Dimension pagesize;
// Size of the page (in dots)
protected int pagedpi;
// Page resolution in dots per inch
protected Font font, headerfont;
// Body font and header font
protected FontMetrics metrics;
// Metrics for the body font
protected FontMetrics headermetrics;
// Metrics for the header font
protected int x0, y0;
// Upper-left corner inside margin
Search WWH ::




Custom Search