RFR: 8311031: JTable header border vertical lines are not aligned with data grid lines [v4]
Abhishek Kumar
abhiscxk at openjdk.org
Fri Jul 14 05:51:12 UTC 2023
On Thu, 6 Jul 2023 08:28:22 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:
>
> Updated based on review comments
Please check for spaces as per standard.
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 76:
> 74:
> 75: table = new JTable(data, columnNames);
> 76: table.setSize(WIDTH,HEIGHT);
Suggestion:
table.setSize(WIDTH, HEIGHT);
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 87:
> 85: w = SCALE * size.width;
> 86: h = SCALE * size.height;
> 87: imgHeader = new BufferedImage((int)(w),(int)(h),BufferedImage.TYPE_INT_RGB);
Suggestion:
imgHeader = new BufferedImage((int)(w), (int)(h), BufferedImage.TYPE_INT_RGB);
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 110:
> 108: verticalLineCol = (int)(table.getTableHeader().
> 109: getColumnModel().getColumn(0).getWidth() * SCALE) - 2;
> 110: expectedRGB = imgData.getRGB(verticalLineCol,0);
Suggestion:
expectedRGB = imgData.getRGB(verticalLineCol, 0);
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 112:
> 110: expectedRGB = imgData.getRGB(verticalLineCol,0);
> 111:
> 112: for(int i = 0; i < imgHeader.getHeight(); i++) {
Suggestion:
for (int i = 0; i < imgHeader.getHeight(); i++) {
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 113:
> 111:
> 112: for(int i = 0; i < imgHeader.getHeight(); i++) {
> 113: for(int j = verticalLineCol; j < verticalLineCol + 3; j++) {
Suggestion:
for (int j = verticalLineCol; j < verticalLineCol + 3; j++) {
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 114:
> 112: for(int i = 0; i < imgHeader.getHeight(); i++) {
> 113: for(int j = verticalLineCol; j < verticalLineCol + 3; j++) {
> 114: if(expectedRGB != imgHeader.getRGB(j, i)) {
Suggestion:
if (expectedRGB != imgHeader.getRGB(j, i)) {
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 120:
> 118: }
> 119:
> 120: for(int i = 0; i < table.getRowCount() * table.getRowHeight() * SCALE; i++) {
Suggestion:
for (int i = 0; i < table.getRowCount() * table.getRowHeight() * SCALE; i++) {
test/jdk/javax/swing/JTableHeader/TableHeaderBorderPositionTest.java line 121:
> 119:
> 120: for(int i = 0; i < table.getRowCount() * table.getRowHeight() * SCALE; i++) {
> 121: for(int j = verticalLineCol; j < verticalLineCol + 3; j++) {
Suggestion:
for (int j = verticalLineCol; j < verticalLineCol + 3; j++) {
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)) {
Suggestion:
if (expectedRGB != imgData.getRGB(j, i)) {
-------------
PR Review: https://git.openjdk.org/jdk/pull/14766#pullrequestreview-1529638406
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263315454
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263316040
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263316535
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263317092
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263317252
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263316846
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263317500
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263317559
PR Review Comment: https://git.openjdk.org/jdk/pull/14766#discussion_r1263317675
More information about the client-libs-dev
mailing list