public class DocumentRenderer extends Object implements Printable
Modifier and Type | Field and Description |
---|---|
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.
|
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
DocumentRenderer(PageFormat pageFormat)
The constructor initializes the pFormat and PJob variables.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected int mCurrentPage
protected JEditorPane mJEditorPane
protected double mPageEndY
protected double mPageStartY
protected boolean mScaleWidthToFit
protected PageFormat mPageFormat
protected PrinterJob mPrintJob
public DocumentRenderer(PageFormat pageFormat)
pageFormat
- Foramt of the Pagepublic void pageDialog()
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
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.6, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)