File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable.print() does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable.print() does not work " Watch "JTable.print() does not work " New topic

JTable.print() does not work

Javed Mohammed

Joined: Sep 29, 2005
Posts: 17

The objective is to get data from the DB and print it.

I got connected to the DB, got the required data. Poplated the data in JTable and used the below mentioned method to print.

It goes to the printer and prints the page with header, a blank box and footer. I checked the JTable and data is populated in it.

I am not displaying the JTable data on the screen, could this be a problem?

Thanks in advance,

Javed Mohammed.
Frank Wynants

Joined: Oct 17, 2007
Posts: 4

The print() method of JTable has lots of problems. When you change the font in the table text gets printed upside-down and other stuff.

I have created an JTable Excel printer API. What it does is take all the data of your JTable and push it into an Excel sheet and print the Excel sheet. You can even use templates (so you only print a number of columns, in a different order, with pre-defined colors).

If interested I can send this to you.

I agree. Here's the link:
subject: JTable.print() does not work
It's not a secret anymore!