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

Tejesh R tr at openjdk.org
Mon Nov 20 11:17:31 UTC 2023


On Mon, 20 Nov 2023 10:56:59 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> For RTL orientation [`getCellRect`](https://github.com/openjdk/jdk/blob/6c5e15c1a291ca5ba1e4c3a90351bc71665ce988/src/java.desktop/share/classes/javax/swing/JTable.java#L2977)  returns position excluding the Offset meaning the gap between panel x till x position of table which is x position of first column.  So instead of modifying at JTable class, I am updating here.
>
> but we dont seem to have any issue with LTR rendering, so why this getXPosition is needed for LTR too?
> Also, wouldn't existing `getRowMargin` have helped?

LTR rendering will work unless the Table is fully occupied w.r.t the Panel. Here the Max width of each column is set which is less than the Panel size where extra space would be there on left side of the Table. LTR doesn't need getXPosition because it'll always be 0/attached to Panel at left position. In JTableHeader [r.x](https://github.com/openjdk/jdk/blob/6c5e15c1a291ca5ba1e4c3a90351bc71665ce988/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java#L399) is computed on this offset basis.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1399044562


More information about the client-libs-dev mailing list