GATE
Version 3.1-2270

gate.print
Class JComponentPrinter

java.lang.Object
  extended by gate.print.JComponentPrinter
All Implemented Interfaces:
Pageable

public class JComponentPrinter
extends Object
implements Pageable

Will scale the component so it fits on a page horizontally


Nested Class Summary
 class JComponentPrinter.TranslatedPrintable
          This inner class's sole responsibility is to translate the coordinate system before invoking a canvas's painter.
 
Field Summary
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
JComponentPrinter(JComponent component, PageFormat format)
           
 
Method Summary
 int getNumberOfPages()
          Returns the number of pages over which the canvas will be drawn.
 PageFormat getPageFormat(int pageIndex)
          Returns the PageFormat of the page specified by pageIndex.
 Printable getPrintable(int pageIndex)
          Returns the Printable instance responsible for rendering the page specified by pageIndex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JComponentPrinter

public JComponentPrinter(JComponent component,
                         PageFormat format)
Method Detail

getNumberOfPages

public int getNumberOfPages()
Returns the number of pages over which the canvas will be drawn.

Specified by:
getNumberOfPages in interface Pageable

getPageFormat

public PageFormat getPageFormat(int pageIndex)
                         throws IndexOutOfBoundsException
Returns the PageFormat of the page specified by pageIndex. The PageFormat is the same for all pages.

Specified by:
getPageFormat in interface Pageable
Parameters:
pageIndex - the zero based index of the page whose PageFormat is being requested
Returns:
the PageFormat describing the size and orientation.
Throws:
IndexOutOfBoundsException - the Pageable does not contain the requested page.

getPrintable

public Printable getPrintable(int pageIndex)
                       throws IndexOutOfBoundsException
Returns the Printable instance responsible for rendering the page specified by pageIndex.

Specified by:
getPrintable in interface Pageable
Parameters:
pageIndex - the zero based index of the page whose Printable is being requested
Returns:
the Printable that renders the page.
Throws:
IndexOutOfBoundsException - the Pageable does not contain the requested page.

GATE
Version 3.1-2270