The Printable class
The Printable objects are the basic elements in the printable document model. They represent concrete objects such as label, line, and rectangle printed on a page. Therefore, printable objects must be added to pages so that they can be previewed and printed.
A printable object class must implement the java.awt.print.Printable interface. In other words, you have to write the print() method of this interface if you want to implement a new printable object. See Java print package and printing API and the JDK™ documentation for more information on this interface.
The definition of the print() method is as follows:
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException
To print, you need to call the methods of the specified Graphics object. You are responsible for setting the correct clip and transformation to position the printing results as wanted.
Some commonly used printable objects are provided as built-in classes in the package.
|
Class |
Purpose |
|
IlvPrintableLine |
To print a line. |
|
IlvPrintableRectangle |
To print a rectangle. |
|
IlvPrintableLabel |
To print a label. |
|
IlvPrintableTable |
To print a portion of the JTable. |
|
IlvPrintableTableHeader |
To print a portion of the JTableHeader. |
.
Some JViews packages provide additional subclasses of IlvPrintableObject. For example, JViews Gantt provides the subclass IlvPrintableTimeScale to print its time scale. For more information, see the JViews Gantt documentation.