practicaltest
Class TestPrint
java.lang.Object
practicaltest.TestPrint
public class TestPrint
- extends java.lang.Object
Sets up to easily print HTML documents.
It is not necessary to call any of the setter
* methods as they all have default values, they
are provided should you wish to change
* any of the default values.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_DPI
public static int DEFAULT_DPI
DEFAULT_PAGE_WIDTH_INCH
public static float DEFAULT_PAGE_WIDTH_INCH
DEFAULT_PAGE_HEIGHT_INCH
public static float DEFAULT_PAGE_HEIGHT_INCH
TestPrint
public TestPrint()
setGraphicsConfiguration
public void setGraphicsConfiguration(java.awt.GraphicsConfiguration gc)
- Set the GraphicsConfiguration to display the print dialog on.
* * @param gc a GraphicsConfiguration object
setServices
public void setServices(javax.print.PrintService[] services)
setDefaultService
public void setDefaultService(javax.print.PrintService service)
setDocFlavor
public void setDocFlavor(javax.print.DocFlavor flavor)
setPrintRequestAttributes
public void setPrintRequestAttributes(javax.print.attribute.PrintRequestAttributeSet attributes)
setPrintDialogLocation
public void setPrintDialogLocation(int x,
int y)
addPrintJobListener
public void addPrintJobListener(javax.print.event.PrintJobListener pjl)
removePrintJobListener
public void removePrintJobListener(javax.print.event.PrintJobListener pjl)
addPrintServiceAttributeListener
public void addPrintServiceAttributeListener(javax.print.event.PrintServiceAttributeListener psal)
removePrintServiceAttributeListener
public void removePrintServiceAttributeListener(javax.print.event.PrintServiceAttributeListener psal)
printJEditorPane
public boolean printJEditorPane(javax.swing.JEditorPane jep,
javax.print.PrintService ps)
printDocument
public boolean printDocument(javax.print.Doc doc,
javax.print.PrintService ps)
throws javax.print.PrintException
- Print the document to the specified PrintService.
* This method cannot tell if the printing was successful.
You must register a PrintJobListener
- Returns:
- false if no PrintService is selected in the dialog, true otherwise
- Throws:
javax.print.PrintException
showPrintDialog
public javax.print.PrintService showPrintDialog()