unbbayes.controller
Class PrintText

java.lang.Object
  extended by unbbayes.controller.PrintText
All Implemented Interfaces:
Pageable, Printable

public class PrintText
extends Object
implements Printable, Pageable

JTextArea printing class


Field Summary
protected  PageFormat pageFormat
           
protected  JTextArea texto
           
 
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
PrintText(JTextArea texto, PageFormat pf)
           
 
Method Summary
 int getNumberOfPages()
          Calculate the number of pages it will take to print the entire text
 PageFormat getPageFormat(int index)
           
 Printable getPrintable(int index)
           
protected  Dimension getPrintSize(int positionX, int positionY)
          Calculate how much of the table will fit on a page without causing a row or column to be split across two pages
protected  void paintText(Graphics g, int positionX, int positionY, Dimension size)
          Paint / print a portion of the text
 int print(Graphics g, PageFormat pf, int index)
          Perform the printing here
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

texto

protected JTextArea texto

pageFormat

protected PageFormat pageFormat
Constructor Detail

PrintText

public PrintText(JTextArea texto,
                 PageFormat pf)
Method Detail

print

public int print(Graphics g,
                 PageFormat pf,
                 int index)
Perform the printing here

Specified by:
print in interface Printable

getPrintSize

protected Dimension getPrintSize(int positionX,
                                 int positionY)
Calculate how much of the table will fit on a page without causing a row or column to be split across two pages


paintText

protected void paintText(Graphics g,
                         int positionX,
                         int positionY,
                         Dimension size)
Paint / print a portion of the text


getNumberOfPages

public int getNumberOfPages()
Calculate the number of pages it will take to print the entire text

Specified by:
getNumberOfPages in interface Pageable

getPrintable

public Printable getPrintable(int index)
Specified by:
getPrintable in interface Pageable

getPageFormat

public PageFormat getPageFormat(int index)
Specified by:
getPageFormat in interface Pageable


Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.