Class PrintHelper

java.lang.Object
net.simplace.core.service.PrintHelper
All Implemented Interfaces:
Printable, Runnable

public class PrintHelper extends Object implements Runnable, Printable
This helper class provides methods used for printing stuff on a printing device.
Author:
Martin Uhlir
  • Field Details

  • Method Details

    • print

      public static void print(Component aComponent, FWObservable aObservable) throws PrinterException
      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
      aObservable -
      Throws:
      PrinterException - is thrown, if no print service is available or any error in the print system caused the job to be aborted
    • print

      public static void print(Component aComponent) throws PrinterException
      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
      Specified by:
      run in interface Runnable
    • print

      public int print(Graphics g, PageFormat pf, int pageIndex)
      Specified by:
      print in interface Printable