I've done some
testing with a DefaultTableModel, and I got the same result. Then I added the table to a JFrame and it worked.
Now I've done some more testing, but I still can't figure out why. I've called repaint() and revalidate() on the table but that doesn't work. Calling setVisible(true) also doesn't work; even an invisible table will get printed once added to a frame. Creating a JFrame just for printing seems so dumb though.
Edit: I did some more testing and found out that printComponent(Graphics) is not called at all. The reason is the size: it is 0x0. If this is the case, any JComponent will not paint or print itself. Once I called table.setSize(table.getPreferredSize()) I could print the table itself, without its header.
[ May 02, 2008: Message edited by: Rob Prime ]