RFR: 5108458: JTable does not properly layout its content [v8]

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Nov 29 10:26:16 UTC 2023


On Tue, 28 Nov 2023 08:34:46 GMT, Tejesh R <tr at openjdk.org> wrote:

>> Table contents does not follow right-left Orientation when Max width of columns are set. This is due to not considering the offset in `x position` while painting table grid and table cell. The fix handles the offset and adjust the x position for each paint, similar to how header is painted. The fix is applied to both Basic and Synth Look and Feel. 
>> The fix is verified for all Look and Feel manually and test verifies on Metal L&F since automatic test cannot be generalized throughout other Look and Feel. 
>> CI tested is green for regression check and test check.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review fix

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java line 2033:

> 2031:             for (int row = rMin; row <= rMax; row++) {
> 2032:                 y += table.getRowHeight(row);
> 2033:                 SwingUtilities2.drawHLine(g, damagedArea.x, damagedArea.x + tableWidth - 1, y - 1);

Is this needed? seems like it's working even without this change..

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableUI.java line 582:

> 580:         TableColumn aColumn;
> 581:         int columnWidth;
> 582:         boolean ltrFlag = table.getComponentOrientation().isLeftToRight();

Is SynthTableUI change needed? Seems like your test is passing for Nimbus L&F even without this file change

test/jdk/javax/swing/JTable/JTableRightOrientationTest.java line 103:

> 101:                                 saveImage(bufferedImage, "failureImage.png");
> 102:                                 failureString = "Test Failed at <" + x + ", " + y + ">";
> 103:                                 break;

This ideally should be done outside EDT..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1408974181
PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1408975271
PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1409070332


More information about the client-libs-dev mailing list