how to print jtables in a print.book

B

beowolf

Hi, I would like to print various jtable(s) in a single printjob.
I've discovered the java.awt.print.Book class and i've found many
helpful examples of its use.
But i'm not able to convert my Jtable(s) to printable for appending it
to the "book".
That is: bk.append((Printable)MyTable1, portrait);
fails at run time with: jtable cannot be cast to printable.
Can anyone address me to some tutorial about how to get a "printable"
object out of a jtable ?
Thank you

cross posted to comp.lang.java.help and comp.lang.java.programmer
 
J

John B. Matthews

beowolf said:
Hi, I would like to print various jtable(s) in a single printjob.
I've discovered the java.awt.print.Book class and i've found many
helpful examples of its use. But i'm not able to convert my Jtable(s)
to printable for appending it to the "book". That is:
bk.append((Printable)MyTable1, portrait); fails at run time with:
jtable cannot be cast to printable. Can anyone address me to some
tutorial about how to get a "printable" object out of a jtable ?

JTable doesn't implement Printable , but you should be able to append
the Pritnable returned by JTable's getPrintable() method. See also,

<http://java.sun.com/javase/6/docs/api/javax/swing/JTable.html>
<http://java.sun.com/docs/books/tutorial/2d/printing/index.html>
<http://java.sun.com/developer/technicalArticles/Printing/SwingPrinting/>

[Followup-To: comp.lang.java.programmer]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top