|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.gui.DocumentPrinting
public class DocumentPrinting
DocumentPrinting is a class that lets you print documents on the fly for free ;) Printing in JDK 1.2 - 1.5 is hard. With this, you just simply call it in your application and add your text component like JTextPane:
new DocumentPrinting().print(YourJTextComponent);Reminder: Just make sure there is a text on your component ;P
Author : Jan Michael Soan WebSite: http://www.jmsoan.com Date : 04/17/2004 Time : 2:20 PMFound on Toolbox (Terms of Use).
| Field Summary |
|---|
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
|---|---|
DocumentPrinting()
Initializes the printing. |
|
| Method Summary | |
|---|---|
javax.swing.text.Document |
getDocument()
Returns the document to print. |
boolean |
getScaleWidthToFit()
Returns whether the width is to be scaled. |
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Prints the page. |
void |
print(javax.swing.JTextPane pane)
Prints the document in the JTextPane. |
void |
printDialog()
Shows the print dialog. |
void |
setContentType(java.lang.String type)
Sets the content type. |
void |
setDocument(javax.swing.JTextPane pane)
Sets the document from the given JTextPane. |
void |
setDocument(java.lang.String type,
javax.swing.text.Document document)
Sets the document and the according content type. |
void |
setScaleWidthToFit(boolean scaleWidth)
Sets whether to scale the width to fit. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DocumentPrinting()
| Method Detail |
|---|
public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
print in interface java.awt.print.Printablegraphics - the graphics contextpageFormat - the format of the pagepageIndex - the page index
Printable.NO_SUCH_PAGE,
Printable.PAGE_EXISTSpublic void print(javax.swing.JTextPane pane)
pane - the document to printpublic void printDialog()
public void setContentType(java.lang.String type)
type - the content typepublic javax.swing.text.Document getDocument()
public void setDocument(javax.swing.JTextPane pane)
pane - the JTextPane to get the document from
public void setDocument(java.lang.String type,
javax.swing.text.Document document)
type - the content typedocument - the document to printpublic void setScaleWidthToFit(boolean scaleWidth)
scaleWidth - if true then the width will be scaledpublic boolean getScaleWidthToFit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||