com.glaivestone.javax.swing.print
Class JComponentPrinter

java.lang.Object
  |
  +--com.glaivestone.javax.awt.print.SimplePaginator
        |
        +--com.glaivestone.javax.swing.print.JComponentPrinter
All Implemented Interfaces:
java.awt.print.Pageable, java.awt.print.Printable

public class JComponentPrinter
extends SimplePaginator
implements java.awt.print.Printable

Print any JComponent with the Java awt print package.

This class requires Java 1.3 or later

Author:
Gary Gregory

Field Summary
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
JComponentPrinter(javax.swing.JComponent component)
          Create a Pageable that can print a Swing JComponent over multiple pages.
JComponentPrinter(javax.swing.JComponent component, java.awt.print.PageFormat format)
          Create a Pageable that can print a Swing JComponent over multiple pages.
 
Method Summary
 double getScaleX()
          Get the scale for the X axis.
 double getScaleY()
          Get the scale for the Y axis.
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
           
 void scaleToFit(boolean useSymmetricScaling)
           
 void scaleToFitX()
           
 void scaleToFitY()
           
 void setScale(double scaleX, double scaleY)
          Set the scale for the X and Y axis.
 
Methods inherited from class com.glaivestone.javax.awt.print.SimplePaginator
getNumberOfPages, getNumberOfPagesX, getNumberOfPagesY, getPageFormat, getPrintable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JComponentPrinter

public JComponentPrinter(javax.swing.JComponent component,
                         java.awt.print.PageFormat format)
Create a Pageable that can print a Swing JComponent over multiple pages.

Parameters:
format - The size of the pages over which the componenent will be printed.

JComponentPrinter

public JComponentPrinter(javax.swing.JComponent component)
Create a Pageable that can print a Swing JComponent over multiple pages.

Method Detail

getScaleX

public double getScaleX()
Get the scale for the X axis.


getScaleY

public double getScaleY()
Get the scale for the Y axis.


print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Specified by:
print in interface java.awt.print.Printable
java.awt.print.PrinterException

setScale

public void setScale(double scaleX,
                     double scaleY)
Set the scale for the X and Y axis.


scaleToFitX

public void scaleToFitX()

scaleToFitY

public void scaleToFitY()

scaleToFit

public void scaleToFit(boolean useSymmetricScaling)

GFL 1.1 API