Hi,
I have been trying to do this for days now...to no avail.
I need to pring out a JTable. My code looks something like the following:
public int print(Graphics g, PageFormat format, int pageIndex) {
table.setSize(new Dimension(260, 75 + 12*table.getModel().getRowCount()));
buffered = PatientPrintManager.disableDoubleBuffering(panel);
g2d.scale(X_SCALE, 1);
table.paint(g2d);
...
Now that works fine. The problem is, header don't show up. So I tried putting the JTable inside a JScrollPane/JPanel/JDialog. You would think this would work out fine. But the problem is, in order for them to work. The JScrollPane/JPanel/JDialog must be visible, otherwise it wont print.
So I create my own classes (of the object above), and overrose the isShowing() method to return true. Now you would think this would work. Wrong again.
Turns out, that before the printing occurs, java checks to see if the object being printed belongs to the correct thread (i.e. the thread that is created when on of the above objects is set to be visible).
So now that none of that works. I need to someone figure out how to show a JTable with headers, without using such objects.
any help is greatly appreciated, as my frustration is pushing me beyong my limits. Thanks!