RFR: 8311031: JTable header border vertical lines are not aligned with data grid lines [v6]
Alexey Ivanov
aivanov at openjdk.org
Tue Jul 25 13:48:47 UTC 2023
On Tue, 18 Jul 2023 04:36:50 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.
>>
>> 
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>
> Review fix
[The same comments](https://github.com/openjdk/jdk/pull/14464#discussion_r1273475982) I left in #14464 apply here.
Yet this change doesn't make all the borders in the table header consistent: there are header cell borders where shadow or highlight are 1- or 2-pixel wide at 175% scale, however, there are now no cases where background colour shines between shadow and highlight.
src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 1114:
> 1112: SwingUtilities2.drawHLine(g, 1, w-1, h-1);
> 1113: g.setColor( MetalLookAndFeel.getControlHighlight() );
> 1114: SwingUtilities2.drawHLine(g, 0, w-2, 0 );
Suggestion:
SwingUtilities2.drawHLine(g, 0, w-2, 0);
You removed other spaces but this one's left.
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 118:
> 116: e.printStackTrace();
> 117: }
> 118: throw new RuntimeException("Test Failed");
Avoid duplicate code, move saving the image into a separate method.
-------------
Changes requested by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14766#pullrequestreview-1545494792
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1273554206
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1273557351
More information about the client-libs-dev
mailing list