unbbayes.controller
Class PrintMonitor
java.lang.Object
unbbayes.controller.PrintMonitor
- All Implemented Interfaces:
- Pageable
public class PrintMonitor
- extends Object
- implements Pageable
Creating an instance of this class and printing it allows it to
add a status dialog during printing. The print requests are
simply delegated to the Pageable that actually contains the
data to be printed, but by intercepting those calls, we can update
the page number displayed in our dialog so that it indicates
which page is currently being displayed.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
printerJob
protected PrinterJob printerJob
pageable
protected Pageable pageable
optionPane
protected JOptionPane optionPane
statusDialog
protected JDialog statusDialog
PrintMonitor
public PrintMonitor(Pageable p)
performPrint
public void performPrint(boolean showDialog)
throws PrinterException
- Create a new thread and have it call the print() method.
This ensures that the AWT event thread will be able to handle
the Cancel button if it is pressed, and can cancel the print job.
- Throws:
PrinterException
getNumberOfPages
public int getNumberOfPages()
- Specified by:
getNumberOfPages
in interface Pageable
getPrintable
public Printable getPrintable(int index)
- Specified by:
getPrintable
in interface Pageable
getPageFormat
public PageFormat getPageFormat(int index)
- Specified by:
getPageFormat
in interface Pageable
Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.