RFR: 8311031: JTable header border vertical lines are not aligned with data grid lines [v5]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Jul 17 14:40:18 UTC 2023


On Fri, 14 Jul 2023 07:35:47 GMT, Tejesh R <tr at openjdk.org> wrote:

>> The header border uses `g.drawLine` whereas the JTable data grid lines uses `SwingUtilities2.drawVLine` and `SwingUtilities2.drawHLine` to draw horizontal and vertical lines. The SwingUtilities2 uses `Graphics.fillRect` which contributes to the difference between the position of these two lines which happens/visible at higher ui scaling (difference in alignment between vertical lines of these two). The fix propose to use the same methods for metal L&F of JTable header border paint. 
>> CI testing shows green.
>> 
>> ![image](https://github.com/openjdk/jdk/assets/94159358/f6d1d822-55ba-4ad3-9914-d3f68b67a6c5)
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comment fix

I hope you have run this test on all mach5 platforms

test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 38:

> 36:  * @bug 8311031
> 37:  * @library /java/awt/regtesthelpers
> 38:  * @build PassFailJFrame

I guess it's no longer manual so this dependency should be removed..

test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 56:

> 54:                 TableHeaderBorderPositionTest.Test();
> 55:             } catch (Exception e) {
> 56:                 throw new RuntimeException(e);

I guess there's no need of `Test()` to have `throws Exception` signature and therefore no need to have this try-catch block..

test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 122:

> 120:         for (int i = 0; i < table.getRowCount() * table.getRowHeight() * SCALE; i++) {
> 121:             for (int j = verticalLineCol; j < verticalLineCol + 3; j++) {
> 122:                 if (expectedRGB != imgData.getRGB(j, i)) {

You probably can write the bufferedimage into png file for debugging help during fail case..

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

PR Review: https://git.openjdk.org/jdk/pull/14766#pullrequestreview-1532945302
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1265455225
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1265461514
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1265464749



More information about the client-libs-dev mailing list