RFR: 8322140: javax/swing/JTable/JTableScrollPrintTest.java does not print the rows and columns of the table in Nimbus and Aqua LookAndFeel [v3]
Abhishek Kumar
abhiscxk at openjdk.org
Wed Apr 10 09:09:05 UTC 2024
On Wed, 10 Apr 2024 04:43:29 GMT, Tejesh R <tr at openjdk.org> wrote:
>> Fix suggested in bug [8210807](https://github.com/openjdk/jdk/commit/38bbbe7588c94d3a0edd1c120ba49cbd0851a720) had a regression in Nimbus L&F yet it resolved the issue in other L&F. The better approach would be to handle `MultiResolutionImages `in `PathGraphics` class `getBufferedImage` method and is suggested here. The fix doesn't cause any regression and is verified in CI system. The test javax/swing/JTable/JTableScrollPrintTest.java is verified for all platforms and all L&F (Except in Windows it doesn't work due an issue ([JDK-8322135](https://bugs.openjdk.org/browse/JDK-8322135)) introduced in 22, yet to investigate on it). And also fix [8210807](https://github.com/openjdk/jdk/commit/38bbbe7588c94d3a0edd1c120ba49cbd0851a720) has been reverted, retaining the test.
>
> Tejesh R has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>
> - Copywrite year updated
> - Merge branch 'master' of https://git.openjdk.java.net/jdk into branch_8322140
> - Spacing updates
> - Updated test with BugID and copyright year
> - Fix + Revert 8210807
src/java.desktop/share/classes/sun/print/PathGraphics.java line 1149:
> 1147: }
> 1148:
> 1149: public static BufferedImage convertToBufferedImage(MultiResolutionImage multiResolutionImage,
Probably the method should be declared as either `private` or `protected`, as adding a `public` method may need a CSR.
May not require to declare it as `static` too.
src/java.desktop/share/classes/sun/print/PathGraphics.java line 1155:
> 1153: resolutionImage.getHeight(null),
> 1154: BufferedImage.TYPE_INT_ARGB);
> 1155: Graphics2D g2d = bufferedImage.createGraphics();
Should we dispose the Graphics2D obj ?
src/java.desktop/share/classes/sun/print/PathGraphics.java line 1156:
> 1154: BufferedImage.TYPE_INT_ARGB);
> 1155: Graphics2D g2d = bufferedImage.createGraphics();
> 1156: g2d.drawImage(resolutionImage, 0, 0, (int)width, (int)height, null);
Suggestion:
g2d.drawImage(resolutionImage, 0, 0, (int) width, (int) height, null);
test/jdk/javax/swing/JTable/JTableScrollPrintTest.java line 45:
> 43: * @test
> 44: * @key headful
> 45: * @bug 8210807 8322140
Suggestion:
You may update the test with `PassFailJFrame.builder()`.
I guess `Graphics2D g2d` object needs to be disposed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18187#discussion_r1559094053
PR Review Comment: https://git.openjdk.org/jdk/pull/18187#discussion_r1559095223
PR Review Comment: https://git.openjdk.org/jdk/pull/18187#discussion_r1559095541
PR Review Comment: https://git.openjdk.org/jdk/pull/18187#discussion_r1559106656
More information about the client-libs-dev
mailing list