All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.wildcrest.TextPrinter

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----com.wildcrest.TextPrinter

public class TextPrinter
extends Canvas
(C) Copyright 1998-1999, Wildcrest Associates (http://www.wildcrest.com). All rights reserved.

A class to perform hardcopy printing of multipage single font text documents. Supports pagination, line wrap, line separators, line spacing, tab expansion, date and page numbering, font selection, margins, headers, footers, page range, page breaks, and print monitor job name.


Constructor Index

 o TextPrinter()
Construct a TextPrinter object

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
 o getAbsoluteTabs()
Returns whether tabs are absolute or relative.
 o getBottomMargin()
Returns the bottom margin of the document.
 o getCenterFooter()
Returns the center footer of the document.
 o getCenterHeader()
Returns the center header of the document.
 o getGapAboveFooter()
Returns the gap between the last line and the footer in inches.
 o getGapBelowHeader()
Returns the gap between the header and first line in inches.
 o getHeaderFooterFont()
Returns the font specified for headers and footers.
 o getInchesPerTab()
Returns the inches per tab stop.
 o getLeftFooter()
Returns the left footer of the document.
 o getLeftHeader()
Returns the left header of the document.
 o getLeftMargin()
Returns the left margin of the document.
 o getLineSpacing()
Returns the line spacing of the document.
 o getPageRange()
Returns the page range of pages to be printed.
 o getPrinterFont()
Returns the font specified for printing.
 o getPrintJobName()
Returns the print job name for this document.
 o getRightFooter()
Returns the right footer of the document.
 o getRightHeader()
Returns the right header of the document.
 o getRightMargin()
Returns the right margin of the document.
 o getTabStops()
Returns the tab stop positions in inches.
 o getText()
Returns the text string to be printed.
 o getTopMargin()
Returns the top margin of the document.
 o getWrap()
Returns whether automatic line wrapping is enabled or disabled.
 o paint(Graphics)
 o print()
Same as print(String) but uses string from most recent setText call
 o print(String)
Print a multipage single font text document, including pagination, line wrap, line separators, line spacing, tab expansion, date and page numbering, font selection, margins, headers, footers, page range, page breaks, and print monitor job name.
 o removePropertyChangeListener(PropertyChangeListener)
 o setAbsoluteTabs(boolean)
Sets whether tabs are absolute (nth tab) or relative (next tab)
 o setBottomMargin(double)
Sets the bottom margin below footer in inches.
 o setCenterFooter(String)
Sets the center footer of the document.
 o setCenterHeader(String)
Sets the center header of the document.
 o setGapAboveFooter(double)
Sets the gap between the last line of text and the footer in inches.
 o setGapBelowHeader(double)
Sets the gap between the header and first line of text in inches.
 o setHeaderFooterFont(Font)
Sets the font for printing the headers and footers of the document.
 o setInchesPerTab(double)
Sets the inches per tab stop.
 o setLeftFooter(String)
Sets the left footer of the document.
 o setLeftHeader(String)
Sets the left header of the document.
 o setLeftMargin(double)
Sets the left margin in inches.
 o setLineSpacing(double)
Sets the line spacing, in multiples of fontHeight.
 o setPageRange(String)
Sets the page range of pages to be printed.
 o setPrinterFont(Font)
Sets the font for printing the body of the document.
 o setPrintJobName(String)
Sets the print job name that appears in the system print monitor.
 o setRightFooter(String)
Sets the right footer of the document.
 o setRightHeader(String)
Sets the right header of the document.
 o setRightMargin(double)
Sets the right margin in inches.
 o setTabStops(double[])
Sets tab stops.
 o setText(String)
Sets (long) text string comprising entire text document to be printed.
 o setTopMargin(double)
Sets the top margin above header in inches.
 o setWrap(boolean)
Sets whether automatic line wrap is enabled or disabled.

Constructors

 o TextPrinter
 public TextPrinter()
Construct a TextPrinter object

Methods

 o setText
 public void setText(String string)
Sets (long) text string comprising entire text document to be printed. Embedded line.separators indicate hard line boundaries or line wraping feature will break lines.

Parameters:
string - the (long) string to be printed
 o getText
 public synchronized String getText()
Returns the text string to be printed.

 o setInchesPerTab
 public void setInchesPerTab(double inchesPerTab)
Sets the inches per tab stop.

Parameters:
inchesPerTab - inches per tab stop. Default: 0.5
 o getInchesPerTab
 public synchronized double getInchesPerTab()
Returns the inches per tab stop.

 o setTabStops
 public void setTabStops(double tabStops[])
Sets tab stops.

Parameters:
tabStops[] - tab stop positions in inches. Default: 0.5, 1.0, 1.5, 2.0, 2.5, ...
 o getTabStops
 public synchronized double[] getTabStops()
Returns the tab stop positions in inches.

 o setLineSpacing
 public void setLineSpacing(double lineSpacing)
Sets the line spacing, in multiples of fontHeight.

Parameters:
lineSpacing - in multiples of fontHeight (1.0=single space, 2.0=double space, etc.) Default: 1.0
 o getLineSpacing
 public synchronized double getLineSpacing()
Returns the line spacing of the document.

 o setPrinterFont
 public void setPrinterFont(Font font)
Sets the font for printing the body of the document.

Parameters:
font - font used for printing body of document. Default: SansSerif, PLAIN, 10
 o getPrinterFont
 public synchronized Font getPrinterFont()
Returns the font specified for printing.

 o setHeaderFooterFont
 public void setHeaderFooterFont(Font font)
Sets the font for printing the headers and footers of the document.

Parameters:
font - font used for printing headers and footers of document. Default: Serif, PLAIN, 10
NOTE: value cannot be changed in free version.
 o getHeaderFooterFont
 public synchronized Font getHeaderFooterFont()
Returns the font specified for headers and footers.

 o setLeftFooter
 public void setLeftFooter(String leftFooter)
Sets the left footer of the document.

Parameters:
leftFooter - string representing the leftFooter. All occurrences of ### (3 pound signs) replaced by current page number. All strings between pairs of ||| (3 vertical bars) passed to Java SimpleDateFormat class to format current date & time. Default: Page ###
See Also:
SimpleDateFormat
 o getLeftFooter
 public synchronized String getLeftFooter()
Returns the left footer of the document.

 o setCenterFooter
 public void setCenterFooter(String centerFooter)
Sets the center footer of the document.

Parameters:
centerFooter - string representing the center footer. Page number and data & time formatting same as for setLeftFooter. Default: |||EEE, MMM d, yyyy|||
 o getCenterFooter
 public synchronized String getCenterFooter()
Returns the center footer of the document.

 o setRightFooter
 public void setRightFooter(String rightFooter)
Sets the right footer of the document.

Parameters:
rightFooter - string representing the right footer. Page number and data & time formatting same as for setLeftFooter. Default: |||hh:mm:ss a zzz|||
 o getRightFooter
 public synchronized String getRightFooter()
Returns the right footer of the document.

 o setLeftHeader
 public void setLeftHeader(String leftHeader)
Sets the left header of the document.

Parameters:
leftHeader - string representing the left header Page number and data & time formatting same as for setLeftFooter. Default: TextPrinter copyright notice
NOTE: value cannot be changed in free version.
 o getLeftHeader
 public synchronized String getLeftHeader()
Returns the left header of the document.

 o setCenterHeader
 public void setCenterHeader(String centerHeader)
Sets the center header of the document.

Parameters:
centerHeader - string representing the center header Page number and data & time formatting same as for setLeftFooter. Default: empty
NOTE: value cannot be changed in free version.
 o getCenterHeader
 public synchronized String getCenterHeader()
Returns the center header of the document.

 o setRightHeader
 public void setRightHeader(String rightHeader)
Sets the right header of the document.

Parameters:
rightHeader - string representing the right header Page number and data & time formatting same as for setLeftFooter. Default: TextPrinter copyright notice
NOTE: value cannot be changed in free version.
 o getRightHeader
 public synchronized String getRightHeader()
Returns the right header of the document.

 o setLeftMargin
 public void setLeftMargin(double leftMargin)
Sets the left margin in inches.

Parameters:
leftMargin - left margin in inches. Default: 0.28
NOTE: optimum value depends on JDK version and OS (see documentation)
 o getLeftMargin
 public synchronized double getLeftMargin()
Returns the left margin of the document.

 o setRightMargin
 public void setRightMargin(double rightMargin)
Sets the right margin in inches.

Parameters:
rightMargin - right margin in inches. Default: 0.56
NOTE: optimum value depends on JDK version and OS (see documentation)
 o getRightMargin
 public synchronized double getRightMargin()
Returns the right margin of the document.

 o setTopMargin
 public void setTopMargin(double topMargin)
Sets the top margin above header in inches.

Parameters:
topMargin - top margin above header in inches. Default: 0.28
NOTE: optimum value depends on JDK version and OS (see documentation)
 o getTopMargin
 public synchronized double getTopMargin()
Returns the top margin of the document.

 o setBottomMargin
 public void setBottomMargin(double bottomMargin)
Sets the bottom margin below footer in inches.

Parameters:
bottomMargin - bottom margin below footer in inches. Default 0.7 >BR>NOTE: optimum value depends on JDK version and OS (see documentation)
 o getBottomMargin
 public synchronized double getBottomMargin()
Returns the bottom margin of the document.

 o setGapBelowHeader
 public void setGapBelowHeader(double gapBelowHeader)
Sets the gap between the header and first line of text in inches.

Parameters:
gapBelowHeader - gap between the header and first line of text. Default 0.25
 o getGapBelowHeader
 public synchronized double getGapBelowHeader()
Returns the gap between the header and first line in inches.

 o setGapAboveFooter
 public void setGapAboveFooter(double gapAboveFooter)
Sets the gap between the last line of text and the footer in inches.

Parameters:
gapAboveFooter - gap between the last line of text and the footer in inches. Default 0.125
 o getGapAboveFooter
 public synchronized double getGapAboveFooter()
Returns the gap between the last line and the footer in inches.

 o setPrintJobName
 public void setPrintJobName(String printJobName)
Sets the print job name that appears in the system print monitor.

Parameters:
printJobName - string representing the print job name. Default: "TextPrinter print document"
 o getPrintJobName
 public synchronized String getPrintJobName()
Returns the print job name for this document.

 o setPageRange
 public void setPageRange(String pageRange)
Sets the page range of pages to be printed. Page ranges specified using same syntax as Microsoft Word, i.e., values separated by commas, values may be a single page number or two page numbers separated by a hyphen. Examples: 1,3,5 1-3,6,8-12 0-1000 Empty string means print all pages. Pages print in order regardless of order in page range.

Parameters:
pageRange - string representing the page range of pages to be printed. Default: "" (= all)
 o getPageRange
 public synchronized String getPageRange()
Returns the page range of pages to be printed.

 o setWrap
 public void setWrap(boolean wrap)
Sets whether automatic line wrap is enabled or disabled.

Parameters:
wrap - whether automatic line wrap is enabled or disabled. Default: true
 o getWrap
 public synchronized boolean getWrap()
Returns whether automatic line wrapping is enabled or disabled.

 o setAbsoluteTabs
 public void setAbsoluteTabs(boolean absoluteTabs)
Sets whether tabs are absolute (nth tab) or relative (next tab)

Parameters:
whether - tabs are absolute or relative. Default: false
 o getAbsoluteTabs
 public synchronized boolean getAbsoluteTabs()
Returns whether tabs are absolute or relative.

 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener l)
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener l)
 o print
 public void print(String string)
Print a multipage single font text document, including pagination, line wrap, line separators, line spacing, tab expansion, date and page numbering, font selection, margins, headers, footers, page range, page breaks, and print monitor job name.

Parameters:
string - a (long) string containing entire document to be printed, which may (or may not) have embedded line.separators, tabs, formfeeds, etc.
 o print
 public void print()
Same as print(String) but uses string from most recent setText call

 o paint
 public synchronized void paint(Graphics g)
Overrides:
paint in class Canvas

All Packages  Class Hierarchy  This Package  Previous  Next  Index