RFR: 8210807: Printing a JTable with a JScrollPane prints table without rows populated [v10]

Andrey Turbanov aturbanov at openjdk.org
Mon Nov 13 08:16:03 UTC 2023


On Fri, 10 Nov 2023 11:36:32 GMT, Tejesh R <tr at openjdk.org> wrote:

>> `BackingStore` uses its own Graphics to Paint the Image. This is fine when we want to paint it on a Window/Frame, but fails to print. Since `WPathGraphics` is used for Printing, backing store fails to print it and backing store uses newly created `SunGraphics2D` always. The proposed fix is to ignore `backingstore` graphics if passed on Graphics is different from `SunGraphics2D` which ensures the Image is painted on Window and also printed when required. 
>> The fix is tested in CI and doesn't cause any regression. The test is verified manually.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review fix

test/jdk/javax/swing/JTable/JTableScrollPrintTest.java line 146:

> 144:                 try {
> 145:                     printJob.print();
> 146:                 } catch(PrinterException pe) {

Suggestion:

                } catch (PrinterException pe) {

test/jdk/javax/swing/JTable/JTableScrollPrintTest.java line 154:

> 152:         public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
> 153:             if (pageIndex > 0) {
> 154:                 return(NO_SUCH_PAGE);

Suggestion:

                return NO_SUCH_PAGE;

test/jdk/javax/swing/JTable/JTableScrollPrintTest.java line 181:

> 179:                 g2d.scale(optimalScale, optimalScale);
> 180:                 c.paint(g2d);
> 181:                 return(PAGE_EXISTS);

Suggestion:

                return PAGE_EXISTS;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16552#discussion_r1390733523
PR Review Comment: https://git.openjdk.org/jdk/pull/16552#discussion_r1390734338
PR Review Comment: https://git.openjdk.org/jdk/pull/16552#discussion_r1390735060


More information about the client-libs-dev mailing list