All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class datarep.common.TextPrinter

java.lang.Object
   |
   +----datarep.common.TextPrinter

public class TextPrinter
extends Object
datarep.common.TextPrinter is a class which provides easy yet flexible printing of text. The print methods can be used for extremely quick printing; other methods provide more control over the output.

Version:
1.2
Author:
Data Representations, Inc.

Constructor Index

 o TextPrinter()
default constructor.
 o TextPrinter(String)
Creates a TextPrinter with the specified title, and using the default font.
 o TextPrinter(String, Font)
Creates a TextPrinter with the specified title and font.

Method Index

 o dispose()
dispose: sends the print job to the printer.
 o formFeed()
formFeed: add a form feed.
 o getColor()
getColor: returns the currently used color.
 o getFont()
getFont: returns the font which is currently being used.
 o getMargins()
getMargins: returns an integer array of the current margins.
 o getTab()
getTab: gets the current tab stops, in inches.
 o getWordWrap()
getWordWrap: returns true if word wrap is on; false if off.
 o main(String[])
prints files.
 o newLine()
newLine: start a new line.
 o print(String)
print(String text): A convenience method.
 o print(String, String)
print(String text, String title): A convenience method.
 o print(String, String, Font)
print(String text, String title, Font font): A convenience method.
 o setColor(Color)
setColor: sets the color of the text to be printed.
 o setFont(Font)
setFont: changes the font to the new value.
 o setMargins(float, float, float, float)
setMargins: sets the page margins.
 o setTab(float)
setTab: sets the tab stops, in inches.
 o setWordWrap(boolean)
setWordWrap: Sets whether or not lines will wrap.
 o write(String)
write: include text to be printed in the current print job.

Constructors

 o TextPrinter
 public TextPrinter()
default constructor. Creates a TextPrinter without a title, and using the default font. Other settings are also set to default values: the tab stop at 0.5 inches, margins on top, bottom, and sides to 1 inch, and the color to black.

 o TextPrinter
 public TextPrinter(String name)
Creates a TextPrinter with the specified title, and using the default font. Other settings are also set to default values: the tab stop at 0.5 inches, margins on top, bottom, and sides to 1 inch, and the color to black.

 o TextPrinter
 public TextPrinter(String name,
                    Font font)
Creates a TextPrinter with the specified title and font. Other settings are also set to default values: the tab stop at 0.5 inches, margins on top, bottom, and sides to 1 inch, and the color to black.

Methods

 o print
 public static void print(String text)
print(String text): A convenience method. Prints the text, using the default font and no title. This is the simplest way to print.

Parameters:
text - a String, which is the text to print
 o print
 public static void print(String text,
                          String title)
print(String text, String title): A convenience method. Prints the text, using the default font and the specified title.

Parameters:
text - a String, which is the text to print
title - a String, which is the title.
 o print
 public static void print(String text,
                          String title,
                          Font font)
print(String text, String title, Font font): A convenience method. Prints the text, with the specified font and title.

 o dispose
 public void dispose()
dispose: sends the print job to the printer. This is a very important method, because it sends the print job to the printer. If you do not call dispose, nothing will be printed (unless the print methods are used).

 o write
 public void write(String text)
write: include text to be printed in the current print job.

Parameters:
text - text to be printed
 o newLine
 public void newLine()
newLine: start a new line. If necessary, a new page is started.

 o formFeed
 public void formFeed()
formFeed: add a form feed. (additional text will be printed on the next page).

 o setFont
 public void setFont(Font font)
setFont: changes the font to the new value.

 o getFont
 public Font getFont()
getFont: returns the font which is currently being used.

 o setColor
 public void setColor(Color color)
setColor: sets the color of the text to be printed.

 o getColor
 public Color getColor()
getColor: returns the currently used color.

 o setTab
 public void setTab(float tab)
setTab: sets the tab stops, in inches.

 o getTab
 public int getTab()
getTab: gets the current tab stops, in inches.

 o setWordWrap
 public void setWordWrap(boolean wrap)
setWordWrap: Sets whether or not lines will wrap.

Parameters:
wrap - if true, word wrap is on. If false, it is off.
 o getWordWrap
 public boolean getWordWrap()
getWordWrap: returns true if word wrap is on; false if off.

 o setMargins
 public void setMargins(float top,
                        float bottom,
                        float left,
                        float right)
setMargins: sets the page margins. The top, bottom, left, and right margins are set in inches.

 o getMargins
 public int[] getMargins()
getMargins: returns an integer array of the current margins.

Returns:
returns an integer array of the top, bottom, left, and right margins in inches.
 o main
 public static void main(String args[])
prints files.


All Packages  Class Hierarchy  This Package  Previous  Next  Index