aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Printing invisible JTable containing JTables - problem 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 invisible JTable containing JTables - problem" Watch "Printing invisible JTable containing JTables - problem" New topic
Author

Printing invisible JTable containing JTables - problem

Alexander Walker
Ranch Hand

Joined: Jun 04, 2010
Posts: 34
Hi,

I am trying to print an invisivle JTable that contains inner JTables (nested). The outer JTable prints as it should, but for some reason the inner JTables header is never printed, even though everything else of the inner JTables is printed as it should, and that is where the problem is. I have tried everything I can think of without solving it.

I would be happy if someone could help me with this.

Thatnks in advance for any help.

In my code the table is made visible after it is printed to show what it should be like.
Here's my example code:
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2216
    
    7
In general the component should be visible on the screen before attempting to print it.

I believe the header is normally not added to the scrollpane until the scrollpane is made visible on the GUI. It looks like you have bypassed this process by using:



Not sure if the same code will work in the renderer.

If not then maybe the approach used in the Screen Image class will help. Maybe you can just create an image of the table and add it to a JLabel and then print the label. Or maybe invoking the "do layout" code will help somehow.
Alexander Walker
Ranch Hand

Joined: Jun 04, 2010
Posts: 34
Rob Camick wrote:If not then maybe the approach used in the Screen Image class will help.


Thanks for the help. The approach used in the Screen Image worked great.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing invisible JTable containing JTables - problem