java.lang.Object
com.iamsoft.util.ui.swing.DocumentRenderer
- All Implemented Interfaces:
Printable
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() or setJEditorPane(). The Document may then be printed by
setting the instance of DocumentRenderer in any PrinterJob.
-
Field Summary
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidintprint(Graphics pGraphics, PageFormat pPageFormat, int pPageIndex) voidprint(JEditorPane pJedPane) voidprint(HTMLDocument pHtmlDocument) voidprint(PlainDocument pPlainDocument) protected voidprotected booleanprintView(Graphics2D pGraphics2D, Shape pAllocation, View pView) protected voidsetContentType(String pType) protected voidsetDocument(String pType, Document pDocument) voidsetDocument(JEditorPane pJedPane) voidsetDocument(HTMLDocument pHtmlDocument) voidsetDocument(PlainDocument pPlainDocument) voidsetScaleWidthToFit(boolean pScaleWidth)
-
Constructor Details
-
DocumentRenderer
public DocumentRenderer()
-
-
Method Details
-
getDocument
-
getScaleWidthToFit
public boolean getScaleWidthToFit() -
pageDialog
public void pageDialog() -
print
-
print
-
print
-
print
-
printDialog
protected void printDialog() -
printView
-
setContentType
-
setDocument
-
setDocument
-
setDocument
-
setDocument
-
setScaleWidthToFit
public void setScaleWidthToFit(boolean pScaleWidth)
-