I am trying to print a JTable and the print() method works great till I come to this scenario. Lets say I want to print before, in the first page only (not header) the text “Report” and on the end the text “This is the end of report”. I would like once more to clarify that I don’t need a header or footer only this text to appear in the top of the first and bottom of the last page when I print them.
How can I do this?
One way to do this is to
append()a series of suitablePrintableinstances to ajava.awt.print.Book, as shown here.Addendum:
JTablehas agetPrintable()method that should simplify things; here’s an outline and simple titlePrintable: