Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mars.venus
Class HardcopyWriter

    java.lang.Object
      java.io.Writer
          mars.venus.HardcopyWriter

All Implemented Interfaces:
  Closeable, Flushable, Appendable

    public class HardcopyWriter

extends Writer

Nested Class Summary
`static class` | `HardcopyWriter.PrintCanceledException` This is the exception class that the HardcopyWriter constructor throws when the user clicks "Cancel" in the print dialog box.

Field Summary
`protected int` | `charnum`
`protected int` | `chars_per_line`
`protected int` | `chars_per_tab`
`protected int` | `charwidth`
`protected Font` | `font`
`protected int` | `fontsize`
`protected Font` | `headerfont`
`protected FontMetrics` | `headermetrics`
`protected int` | `headery`
`protected int` | `height`
`protected PrintJob` | `job`
`protected String` | `jobname`
`protected int` | `lineascent`
`protected int` | `lineheight`
`protected int` | `linenum`
`protected int` | `lines_per_page`
`protected FontMetrics` | `metrics`
`protected Graphics` | `page`
`protected int` | `pagedpi`
`protected int` | `pagenum`
`protected Dimension` | `pagesize`
`protected static Properties` | `printprops`
`protected String` | `time`
`protected int` | `width`
`protected int` | `x0`
`protected int` | `y0`

Fields inherited from class java.io.Writer
`lock`

Constructor Summary
`HardcopyWriter(Frame frame, String jobname, int fontsize, double leftmargin, double rightmargin, double topmargin, double bottommargin)` The constructor for this class has a bunch of arguments: The frame argument is required for all printing in Java.

Method Summary
`void` | `close()` This is the close( ) method that all Writer subclasses must implement.
`void` | `flush()` This is the flush( ) method that all Writer subclasses must implement.
`int` | `getCharactersPerLine()` Return the number of columns of characters that fit on the page
`int` | `getLinesPerPage()` Return the number of lines that fit on a page
`static void` | `main(String[] args)` A program that prints the specified file using HardcopyWriter
`protected void` | `newline()` This internal method begins a new line
`protected void` | `newpage()` This internal method begins a new page and prints the header.
`void` | `pageBreak()` End the current page.
`void` | `setFontStyle(int style)` Set the font style.
`void` | `write(char[] buffer, int index, int len)` This is the write( ) method of the stream.

Methods inherited from class java.io.Writer
`append, append, append, write, write, write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### job

    protected PrintJob job

### page

    protected Graphics page

### jobname

    protected String jobname

### fontsize

    protected int fontsize

### time

    protected String time

### pagesize

    protected Dimension pagesize

### pagedpi

    protected int pagedpi

### font

    protected Font font

### headerfont

    protected Font headerfont

### metrics

    protected FontMetrics metrics

### headermetrics

    protected FontMetrics headermetrics

### x0

    protected int x0

### y0

    protected int y0

### width

    protected int width

### height

    protected int height

### headery

    protected int headery

### charwidth

    protected int charwidth

### lineheight

    protected int lineheight

### lineascent

    protected int lineascent

### chars_per_line

    protected int chars_per_line

### lines_per_page

    protected int lines_per_page

### chars_per_tab

    protected int chars_per_tab

### charnum

    protected int charnum

### linenum

    protected int linenum

### pagenum

    protected int pagenum

### printprops

    protected static Properties printprops

Constructor Detail

### HardcopyWriter

    public HardcopyWriter(Frame frame,
                          String jobname,
                          int fontsize,
                          double leftmargin,
                          double rightmargin,
                          double topmargin,
                          double bottommargin)
                   throws HardcopyWriter.PrintCanceledException

  The constructor for this class has a bunch of arguments: The frame argument is required for all printing in Java. The jobname appears left justified at the top of each printed page. The font size is specified in points, as on-screen font sizes are. The margins are specified in inches (or fractions of inches).

  Throws:
    `HardcopyWriter.PrintCanceledException`

Method Detail

### write

    public void write(char[] buffer,
                      int index,
                      int len)

  This is the write( ) method of the stream. All Writer subclasses implement this. All other versions of write( ) are variants of this one

  Specified by:
    `write` in class `Writer`

### flush

    public void flush()

  This is the flush( ) method that all Writer subclasses must implement. There is no way to flush a PrintJob without prematurely printing the page, so we don't do anything.

  Specified by:
    `flush` in interface `Flushable`
  Specified by:
    `flush` in class `Writer`

### close

    public void close()

  This is the close( ) method that all Writer subclasses must implement. Print the pending page (if any) and terminate the PrintJob.

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in class `Writer`

### setFontStyle

    public void setFontStyle(int style)

  Set the font style. The argument should be one of the font style constants defined by the java.awt.Font class. All subsequent output will be in that style. This method relies on all styles of the Monospaced font having the same metrics.

### pageBreak

    public void pageBreak()

  End the current page. Subsequent output will be on a new page.

### getCharactersPerLine

    public int getCharactersPerLine()

  Return the number of columns of characters that fit on the page

### getLinesPerPage

    public int getLinesPerPage()

  Return the number of lines that fit on a page

### newline

    protected void newline()

  This internal method begins a new line

### newpage

    protected void newpage()

  This internal method begins a new page and prints the header.

### main

    public static void main(String[] args)

  A program that prints the specified file using HardcopyWriter

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD