RFR: 8236907: JTable added to nested panels does not paint last visible row [v6]
Phil Race
prr at openjdk.java.net
Fri Feb 25 22:38:58 UTC 2022
On Tue, 22 Feb 2022 04:38:21 GMT, Tejesh R <duke at openjdk.java.net> wrote:
>> Issue in painting last row of JTable due to decrement in `MaxRow `during computation. Differences in `MaxRow `computation between `TablePrintable` and `BasicTableUI `class. The Bug is fixed in both the classes. Test Case added to validate the same.
>
> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>
> 8236907: JTable added to nested panels does not paint last
src/java.desktop/share/classes/javax/swing/TablePrintable.java line 400:
> 398: Rectangle bounds = table.getBounds();
> 399: bounds.x = bounds.y = 0;
> 400:
why was the x=0, y=0 necessary ? And if it wasn't (0,0) already that is a significant change
src/java.desktop/share/classes/javax/swing/TablePrintable.java line 406:
> 404: Point lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
> 405: visibleBounds.y + visibleBounds.height - 1);
> 406:
What is the effect of the -1 ? Meaning what happens if you don't do it - how did it contribute to the bug ?
And if this is about height why the -1 on the width too ?
src/java.desktop/share/classes/javax/swing/TablePrintable.java line 416:
> 414: }
> 415: int rowHeight = 0;
> 416: for(int visrow = rMin; visrow <= rMax; visrow++) {
So was the issue here that this is a 1 based index not a zero-based index and we basically had an off-by-one bug ?
nit : for( -> "for ("
-------------
PR: https://git.openjdk.java.net/jdk/pull/7422
More information about the client-libs-dev
mailing list