Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing invisible JTable containing JTables - problem

 
Alexander Walker
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic