kiwi.util
Class ComponentPrinter
java.lang.Object
kiwi.util.ComponentPrinter
- All Implemented Interfaces:
- java.awt.print.Printable
- public class ComponentPrinter
- extends java.lang.Object
- implements java.awt.print.Printable
A class for printing arbitrary components. To print a given component,
simply use the class as follows:
ComponentPrinter cp = new ComponentPrinter(someComponent);
cp.print();
The print()
method may be invoked multiple times.
- Since:
- Kiwi 1.3.4
- Author:
- Marty Hall, John N. Kostaras, Mark Lindner
Field Summary |
private java.awt.Component |
component
|
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary |
ComponentPrinter(java.awt.Component component)
Construct a new ComponentPrinter for printing the specified
component. |
Method Summary |
void |
print()
Print the component. |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Implementation of the Printable interface; this method
should not be called directly. |
void |
setComponent(java.awt.Component component)
Specify a different component to be printed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
component
private java.awt.Component component
ComponentPrinter
public ComponentPrinter(java.awt.Component component)
- Construct a new
ComponentPrinter
for printing the specified
component.
- Parameters:
component
- The component to be printed.
setComponent
public void setComponent(java.awt.Component component)
- Specify a different component to be printed.
- Parameters:
component
- The new component.
print
public void print()
throws java.awt.print.PrinterException
- Print the component.
- Throws:
java.awt.print.PrinterException
- If an error occurred during
printing.
print
public int print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex)
- Implementation of the
Printable
interface; this method
should not be called directly.
- Specified by:
print
in interface java.awt.print.Printable