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 Problem printing JPanel in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem printing JPanel in JTable" Watch "Problem printing JPanel in JTable" New topic

Problem printing JPanel in JTable

Sheila Wallace

Joined: May 24, 2001
Posts: 10
I have a strange problem when pritning. I am printing a JTable by printong each table cell individually. In order to do this I call print(graphics) on the component within the table cell. One of the cells of the JTable contains a JPanel which contains 2 JLabels. No matter what I do, the JLabels within the JPanel will not print. The clip bounds passed to the component are correct as I can draw them ok. If I change the cell to contain only a JLabel it will print correctly, but as soon as I put it inside a JPanel the JLabel will not print.
Any ideas?
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
What layout manager are you using in your JPanel?

The nice thing about Standards is that there are so many to choose from!
Sheila Wallace

Joined: May 24, 2001
Posts: 10
I am using BorderLayout but have tried changing it to FlowLayout, GridLayout etc and still no joy.
If you pass clip bounds to a Container, how does it translate those for it's children?
I agree. Here's the link:
subject: Problem printing JPanel in JTable
It's not a secret anymore!