Decision Applications
CONTACTS
|
PrintUtilitiesWhen you read the comments for the PrintUtilities class, you can see that it has gone through a number of hands to reach its current state. The Java™ print API is a little difficult to work with, so hopefully we can give back to the community a little with this class. This class could use some work. For instance, many calculations are repeated for every page. But this class does print a Java™ component, with page breaks at places between components. The printed page has a header and footer. A subheader can have any text, and the subfooter has the text “Page 1 of 7 pages,” for example. To print a Java Component: import java.awt.print.PageFormat; The page breaks array can be generated by getting the location of the bottom of each GUI element displayed in the Component. If all of the components are located in rows, then this method could be used to generate the page breaks:
import java.awt.Container; |