|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.util.TextPrinter
public class TextPrinter
enables printing of plain text with line wrapping over multiple pages
PrintUtilities| Field Summary | |
|---|---|
protected ArrayList<StringBuilder> |
pageText
|
static Font |
standardFont
the standard font used when no specific font was specified for a TextPrinter |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
|---|---|
TextPrinter(String text)
|
|
TextPrinter(String text,
Font font,
Color color)
|
|
| Method Summary | |
|---|---|
Color |
getColor()
|
Font |
getFont()
|
String |
getText()
returns the text this object has been instanciated with. |
int |
print(Graphics g,
PageFormat format,
int pageIndex)
|
protected String |
printPage(Graphics g,
PageFormat format,
StringBuilder text)
prints the given text onto the given format using the given graphics. |
protected String |
printParagraph(Graphics2D g,
PageFormat format,
String paragraph,
Point2D.Float pen)
|
void |
setColor(Color color)
|
void |
setFont(Font font)
|
void |
startPrint()
prints this TextPrinter directly to the default printer |
void |
startPrint(PrinterJob job,
boolean showDialog)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static Font standardFont
protected ArrayList<StringBuilder> pageText
| Constructor Detail |
|---|
public TextPrinter(String text)
public TextPrinter(String text,
Font font,
Color color)
| Method Detail |
|---|
public String getText()
null as text,
this method returns an empty string.
public void setFont(Font font)
public void setColor(Color color)
public Font getFont()
public Color getColor()
public void startPrint()
throws PrinterException
PrinterException
public void startPrint(PrinterJob job,
boolean showDialog)
throws PrinterException
PrinterException
public int print(Graphics g,
PageFormat format,
int pageIndex)
throws PrinterException
print in interface PrintablePrinterException
protected String printPage(Graphics g,
PageFormat format,
StringBuilder text)
protected String printParagraph(Graphics2D g,
PageFormat format,
String paragraph,
Point2D.Float pen)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||