Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4970112
Votes 0
Synopsis JTable printing completely broken - only the table grid is printed.
Category java:classes_swing
Reported Against tiger-beta
Release Fixed 1.5(tiger-b32)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs 4352983
Submit Date 17-DEC-2003
Description
Something in the fix to 4352983 has completely broken JTable printing. When printing a JTable, only the table grid is printed. This is not a bug in the new JTable printing code and happens regardless of which route you print a JTable.

To see the problem, compile the attached files and run Printing.java. Hit the "Print" button to print the table. The output will only have a grid and no cell data.

JTable does its cell printing through a CellRendererPane. My investigation began with CellRendererPane, and noticing that it calls g.create(int, int, int, int), I looked at the changes to the graphics "create" methods for 4352983. This led to sun.print.ProxyGraphics2D. The method "create(int, int, int, int)" was overridden as part of the fix to 4352983. The implementation follows:

public Graphics create(int x, int y, int width, int height) {
    return new ProxyGraphics2D((Graphics2D) mGraphics.create(x, y, width, height), mPrinterJob);
}

If these three lines are removed from ProxyGraphics2D.java, the problem goes away.

Fixing this bug is extremely important - without it, JTable printing is useless.
Work Around
N/A
Evaluation
  xxxxx@xxxxx   suggested to remove the mentioned code from ProxyGraphics2D.
----

Apologies, I failed to include the attachments when I filed this bug. The two files required to run the test in the description have now been attached.
  xxxxx@xxxxx   2003-12-18
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang