Package net.simplace.core.service
Class PrintHelper
java.lang.Object
net.simplace.core.service.PrintHelper
This helper class provides methods used for printing stuff on a printing device.
- Author:
- Martin Uhlir
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Method Summary
Modifier and TypeMethodDescriptionstatic voidPrints a GUI component on a printer.static voidprint(Component aComponent, FWObservable aObservable) Prints a GUI component on a printer.intprint(Graphics g, PageFormat pf, int pageIndex) voidrun()Handles the whole printing process.
-
Field Details
-
TYPE_PDF
public static final int TYPE_PDF- See Also:
-
TYPE_RTF
public static final int TYPE_RTF- See Also:
-
TYPE_HTML
public static final int TYPE_HTML- See Also:
-
-
Method Details
-
print
Prints a GUI component on a printer. Before printing is started, a cross-platform dialog appears to the user who can select the desired printer and customise the print properties. If the print dialog is canceled, no print job will start.- Parameters:
aComponent- a GUI component to be printedaObservable-- Throws:
PrinterException- is thrown, if no print service is available or any error in the print system caused the job to be aborted
-
print
Prints a GUI component on a printer. Before printing is started, a cross-platform dialog appears to the user who can select the desired printer and customise the print properties. If the print dialog is canceled, no print job will start.- Parameters:
aComponent- a GUI component to be printed- Throws:
PrinterException- is thrown, if no print service is available or any error in the print system caused the job to be aborted
-
run
public void run()Handles the whole printing process.
Note: it's implemented in a new thread because looking up the printing device takes a lot of time -
print
-