Class DocumentPrintable

java.lang.Object
  extended by DocumentPrintable
All Implemented Interfaces:
java.awt.print.Printable

public class DocumentPrintable
extends java.lang.Object
implements java.awt.print.Printable

The implementation of Printable. Prints the StyledDocument.

Version:
07.08.2007
Author:
Marc Seidemann

Field Summary
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
DocumentPrintable(java.lang.Integer[] pageBreaks, java.lang.Integer[] lineBreaks, int linesPerPage, int lineHeight, javax.swing.text.StyledDocument d, int fontsize)
          Creates a DocumentPrintable-object
 
Method Summary
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          Prints the StyledDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentPrintable

DocumentPrintable(java.lang.Integer[] pageBreaks,
                  java.lang.Integer[] lineBreaks,
                  int linesPerPage,
                  int lineHeight,
                  javax.swing.text.StyledDocument d,
                  int fontsize)
Creates a DocumentPrintable-object

Parameters:
pageBreaks - The indices of the pagebreaks
lineBreaks - The indices of the lineBreaks
linesPerPage - The number of lines per page
lineHeight - The height of a line
d - The StyledDocument that should be printed
fontsize - The fontsize of the print
Method Detail

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
Prints the StyledDocument

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - The Graphics-object of the PrinterJob
pf - The PageFormat of the PrinterJob
pageIndex - The page-index