Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Printing JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Printing JTable" Watch "Printing JTable" New topic

Printing JTable

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Hi All,
Can somebody tell me how to print the contents of a JTable. My requirement is i have a JTable with some data. The entire table along with its header, should be printed.
Please give me some sample code.
Thanks in advance.
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
Hello Satya,

Here's a (q&d) sample. I think you may adjust it to your needs.

You may found useful to look at some reporting tools too (like JasperReports).

Hope that helps,

Lionel Badiou
CodeFutures Software
sasi kala
Ranch Hand

Joined: Dec 17, 2004
Posts: 68
hi Lionel Badiou,

i am also having the same problem. my requirement is to print a html
page which is placed in JEditorPane. By using ur example program i am able
to print my html page.

thank you very much.

but i am unable to specify the number of pages to print.

i have one question regarding this How to count the number of lines in
so that i can specify the number of pages to be printed.

Thanks in Advance.

[ April 21, 2005: Message edited by: sasi kala ]
I agree. Here's the link:
subject: Printing JTable
jQuery in Action, 3rd edition