logo
  Pageable and Flowable
logo

[Pageable] [Flowable]


J2PrinterWorks printing is controlled by two primary printing classes, Pageable and Flowable.

Pageable

Pageable is a standard class that comes with Java, specifically java.awt.print.Pageable.  J2PrinterWorks can create and print any document consisting of one or more multi-page java.awt.print.Pageable instances, where each Pageable starts and ends on page boundaries.

J2PrinterWorks comes with 7 Pageable components of its own:

In addition you create and intermix your own custom java.awt.print.Pageable instances with any of the above.

J2PrinterWorks lets you specify the headers, footers, margins, centering, orientation, and scale separately for each instance of the Pageable components above. You can have one set of headers and footers for the first page of any Pageable and a different set for the remaining pages. Headers and footers support page numbering and date/time formatting. There are separate left, right, and center headers as well as footers. Each header or footer can be a simple one-line String, or it can be a JLabel defined using HTML and thereby span multiple lines and contain rich text and images.
 

Flowable

In addition to supporting Pageables, J2PrinterWorks introduces a new printing interface called Flowable, specifically com.wildcrest.j2printerworks.Flowable. Like Pageables, Flowables are printable components that may span multiple pages, but unlike Pageables, they can also begin and end in the middle of any page. A J2FlowPrinter instance can group together any number of Flowable instances, one immediately following after another back-to-back down the page. The resulting J2FlowPrinter instance is a Pageable (i.e., beginning and ending on page boundaries) that represents a packed-together series of Flowables.  Every J2FlowPrinter instance is also a Flowable, so that J2FlowPrinter instances can be strung together or nested.

The following Flowables are provided by J2PrinterWorks:

In addition you can create and intermix your own custom com.wildcrest.j2printerworks.Flowable instances, which you create by implementing the Flowable interface.  See the Sample Programs: Custom Flowables section for further details and sample code for creating your own custom Flowables.

By stringing together a series of Flowables, you can do things like include a JTable, a JTree, a JList, a third-party Component, a drawing, an Image, or the contents of a program window (in a JPanel) within an overall document otherwise made up of JTextPane instances, placing titles above and/or a captions below any of these components. Each Flowable can be scaled independently, horizontally justified left, right, or center within the page width, and vertically justified top, bottom, or center within the remaining space in the page.

Copyright 2009, Wildcrest Associates (http://www.wildcrest.com)