|
TV-Browser 2.7.5 API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectprintplugin.printer.singleprogramprinter.DocumentRenderer
public class DocumentRenderer
DocumentRenderer prints objects of type Document. Text attributes, including fonts, color, and small icons, will be rendered to a printed page. DocumentRenderer computes line breaks, paginates, and performs other formatting. An HTMLDocument is printed by sending it as an argument to the print(HTMLDocument) method. A PlainDocument is printed the same way. Other types of documents must be sent in a JEditorPane as an argument to the print(JEditorPane) method. Printing Documents in this way will automatically display a print dialog. As objects which implement the Printable Interface, instances of the DocumentRenderer class can also be used as the argument in the setPrintable method of the PrinterJob class. Instead of using the print() methods detailed above, a programmer may gain access to the formatting capabilities of this class without using its print dialog by creating an instance of DocumentRenderer and setting the document to be printed with the setDocument(). The Document may then be printed by setting the instance of DocumentRenderer in any PrinterJob.
| Field Summary | |
|---|---|
protected int |
mCurrentPage
Used to keep track of when the page to print changes. |
protected JEditorPane |
mJEditorPane
Container to hold the Document. |
protected double |
mPageEndY
Location of the current page end |
protected PageFormat |
mPageFormat
The DocumentRenderer class uses pFormat and pJob in its methods. |
protected double |
mPageStartY
Location of the current page start |
protected PrinterJob |
mPrintJob
The PrintJob |
protected boolean |
mScaleWidthToFit
boolean to allow control over whether pages too wide to fit on a page will be scaled. |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
|---|---|
DocumentRenderer(PageFormat pageFormat)
The constructor initializes the pFormat and PJob variables. |
|
| Method Summary | |
|---|---|
int |
getPageCount()
Calculates the Number of Pages |
boolean |
getScaleWidthToFit()
Method to get the current choice the width scaling option. |
void |
pageDialog()
pageDialog() displays a page setup dialog. |
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
The print method implements the Printable interface. |
protected boolean |
printView(Graphics2D graphics2D,
Shape allocation,
View view)
printView is a recursive method which iterates through the tree structure of the view sent to it. |
protected void |
setContentType(String type)
Method to set the content type the JEditorPane. |
protected void |
setDocument(String type,
Document document)
Method to set the content type and document of the JEditorPane. |
void |
setEditorPane(JEditorPane jedPane)
Method to set the JEditorPane that will be printed |
void |
setScaleWidthToFit(boolean scaleWidth)
Method to set the current choice of the width scaling option. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int mCurrentPage
protected JEditorPane mJEditorPane
protected double mPageEndY
protected double mPageStartY
protected boolean mScaleWidthToFit
protected PageFormat mPageFormat
protected PrinterJob mPrintJob
| Constructor Detail |
|---|
public DocumentRenderer(PageFormat pageFormat)
pageFormat - Foramt of the Page| Method Detail |
|---|
public void pageDialog()
public int print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
print in interface Printable
protected boolean printView(Graphics2D graphics2D,
Shape allocation,
View view)
protected void setDocument(String type,
Document document)
protected void setContentType(String type)
public void setEditorPane(JEditorPane jedPane)
public void setScaleWidthToFit(boolean scaleWidth)
public boolean getScaleWidthToFit()
public int getPageCount()
|
TV-Browser 2.7.5 API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||