|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nih.nlm.util.JComponentPrintHandler
Handles printing of HTML documents. Text attributes, including
fonts, color, and small icons, will be rendered to a printed page.
JComponentPrintHandler
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 Document
s 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 unless the printer name
has been specified.
Field Summary | |
protected JEditorPane |
jeditor_pane
|
protected JTable |
jtable
|
protected JTree |
jtree
|
protected PageFormat |
p_format
|
protected PrinterJob |
p_job
|
protected PrintService |
p_service
|
protected int |
pages_per_sheet
|
protected int |
pages_printed
|
protected String |
printer_name
|
protected boolean |
scale_width_to_fit
|
protected double |
scaling_factor
|
protected String |
title
|
Constructor Summary | |
JComponentPrintHandler()
Instantiates an JComponentPrintHandler . |
Method Summary | |
int |
getPagesPerSheet()
Returns the number of pages per sheet. |
String |
getPrinterName()
Returns the printer name. |
String[] |
getPrinterNames()
Returns the list of available printer names. |
boolean |
getScaleWidthToFit()
Indicates whether or not the document should be scaled to fit the width of the page. |
double |
getScalingFactor()
Returns the scaling factor. |
String |
getTitle()
Returns the title. |
void |
pageDialog()
Displays a page setup dialog. |
int |
print(JEditorPane jed_pane)
Prints the specified JEditorPane . |
int |
print(JTable jtable)
Prints the specified JTable . |
int |
print(JTree jtree)
Prints the specified JTable . |
protected int |
printDialog()
Displays the print dialog and initiates printing in response to user input. |
void |
setOnePagePerSheet()
Sets the number of pages per sheet to one (1). |
void |
setPrintComponent(JEditorPane jed_pane)
Sets the component to print to the JEditorPane . |
void |
setPrintComponent(JTable jt)
Sets the component to print to the JTable . |
void |
setPrintComponent(JTree jt)
Sets the component to print to the JTable . |
void |
setPrinterName(String printer_name)
Sets the printer name. |
void |
setScaleWidthToFit(boolean scale_width_to_fit)
Set the scale width to fit flag. |
void |
setScalingFactor(double scaling_factor)
Sets the scaling factor. |
void |
setTitle(String title)
Sets the title. |
void |
setTwoPagesPerSheet()
Sets the number of pages per sheet to two (2). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected JEditorPane jeditor_pane
protected JTree jtree
protected JTable jtable
protected PageFormat p_format
protected PrinterJob p_job
protected PrintService p_service
protected String printer_name
protected int pages_per_sheet
protected int pages_printed
protected String title
protected boolean scale_width_to_fit
protected double scaling_factor
Constructor Detail |
public JComponentPrintHandler()
JComponentPrintHandler
.
Method Detail |
public void setScaleWidthToFit(boolean scale_width_to_fit)
scale_width_to_fit
- a flag indiciating whether or not to
scale the content to fit into the allowable widthpublic boolean getScaleWidthToFit()
true if it should, false
otherwise
public void setScalingFactor(double scaling_factor)
scaling_factor
- the scaling factor (higher is smaller)public double getScalingFactor()
public void setPrinterName(String printer_name)
printer_name
- the printer namepublic String getPrinterName()
public String[] getPrinterNames()
public void setTitle(String title)
title
- the titlepublic String getTitle()
public int getPagesPerSheet()
public void setOnePagePerSheet()
public void setTwoPagesPerSheet()
public void pageDialog()
public int print(JEditorPane jed_pane) throws PrinterException
JEditorPane
.
jed_pane
- the JEditorPane
to print
PrinterException
- if failed to print documentpublic int print(JTable jtable) throws PrinterException
JTable
.
jtable
- the JTable
to print
PrinterException
- if failed to print documentpublic int print(JTree jtree) throws PrinterException
JTable
.
jtree
- the JTable
to print
PrinterException
- if failed to print documentprotected int printDialog() throws PrinterException
PrinterException
- if failed to print documentpublic void setPrintComponent(JEditorPane jed_pane)
JEditorPane
.
jed_pane
- the JEditorPane
public void setPrintComponent(JTable jt)
JTable
.
jt
- the JTable
public void setPrintComponent(JTree jt)
JTable
.
jt
- the JTable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |