From: beowolf on 3 Jul 2010 12:36 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
From: John B. Matthews on 3 Jul 2010 13:15 In article <d2b7ee1a-d4d8-46a0-9ce8-176c109f44bc(a)y11g2000yqm.googlegroups.com>, beowolf <michiedo(a)email.it> wrote: > 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] -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
|
Pages: 1 Prev: Possible BUG in Mixed Code Security Warning? Next: Problem with Email Program in TCP |