lt.monarch.print
Class ComponentPrintable

java.lang.Object
  extended by lt.monarch.print.AbstractPrintable
      extended by lt.monarch.print.ComponentPrintable
All Implemented Interfaces:
java.awt.print.Printable, PrintableConstants

public class ComponentPrintable
extends AbstractPrintable

Printable implementation for printing GUI components. Scaling and alignment of printout can be customized using methods provided in AbstractPrintable superclass.


Field Summary
Modifier and Type Field and Description
 
Fields inherited from class lt.monarch.print.AbstractPrintable
headerFooterRenderer, horizontalAlignment, lastValidPageIndex, scaligFactorSpecified, scalingFitToPagesGridCols, scalingFitToPagesGridRows, scalingMode, verticalAlignment
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface lt.monarch.print.PrintableConstants
ALIGNMENT_BOTTOM, ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP, SCALING_FACTOR_SPECIFIED, SCALING_FIT_TO_PAGES
 
Constructor Summary
Constructor and Description
ComponentPrintable(java.awt.Component componentToPrint)
          Creates new instance of ComponentPrintable for printing given component.
 
Method Summary
Modifier and Type Method and Description
 void dispose()
          This method should be invoked after printing is finished and ComponentPrintable object is no longer necessary.
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
          Implements the print method of Printable interface.
 
Methods inherited from class lt.monarch.print.AbstractPrintable
getHeaderFooterRenderer, setHeaderFooterRenderer, setHorizontalAlignment, setScalingFactorSpecified, setScalingFitToPagesGrid, setScalingMode, setVerticalAlignment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentPrintable

public ComponentPrintable(java.awt.Component componentToPrint)
Creates new instance of ComponentPrintable for printing given component.

Parameters:
componentToPrint - component for printing.
Method Detail

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Implements the print method of Printable interface.

Parameters:
graphics - Graphics context
pageFormat - format of page
pageIndex - index of page
Returns:
value showing if page has been printed or not
Throws:
java.awt.print.PrinterException

dispose

public void dispose()
This method should be invoked after printing is finished and ComponentPrintable object is no longer necessary.

Overrides:
dispose in class AbstractPrintable