On Tue, 21 Nov 2023 08:10:43 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> Yes, actually it is not required because it gives/should give the same x >> position value. Have to remove it, might have added for checking if it had >> any effect on LTR. > > I guess you can simplify the fix without using `getXPosition`..You probably > would still need `getWidthInRIghtToLeft` but as suggested, having an unified > method in a common class like SwingUtilities2 is desirable...Let me know if > this will work.. > > > --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java > +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java > @@ -2028,9 +2028,19 @@ private void paintGrid(Graphics g, int rMin, int rMax, > int cMin, int cMax) { > if (table.getShowHorizontalLines()) { > int tableWidth = damagedArea.x + damagedArea.width; > int y = damagedArea.y; > - for (int row = rMin; row <= rMax; row++) { > - y += table.getRowHeight(row); > - SwingUtilities2.drawHLine(g, damagedArea.x, tableWidth - 1, > y - 1); > + if (table.getComponentOrientation().isLeftToRight()) { > + for (int row = rMin; row <= rMax; row++) { > + y += table.getRowHeight(row); > + SwingUtilities2.drawHLine(g, damagedArea.x, tableWidth - > 1, y - 1); > + } > + } else { > + TableColumnModel cm = table.getColumnModel(); > + for (int row = rMax; row >= rMin; row--) { > + y += table.getRowHeight(row); > + int w = cm.getColumn(cMax).getWidth(); > + damagedArea.x = table.getWidth() - (w * (cMax + 1)); > + SwingUtilities2.drawHLine(g, damagedArea.x, > table.getWidth() - 1, y - 1); > + } > } > } > if (table.getShowVerticalLines()) { > @@ -2090,18 +2100,12 @@ private void paintCells(Graphics g, int rMin, int > rMax, int cMin, int cMax) { > } > } else { > for(int row = rMin; row <= rMax; row++) { > - cellRect = table.getCellRect(row, cMin, false); > - aColumn = cm.getColumn(cMin); > - if (aColumn != draggedColumn) { > - columnWidth = aColumn.getWidth(); > - cellRect.width = columnWidth - columnMargin; > - paintCell(g, cellRect, row, cMin); > - } > - for(int column = cMin+1; column <= cMax; column++) { > + for(int column = cMin; column <= cMax; column++) { > + cellRect = table.getCellRect(row, column, false); > aColumn = cm.getColumn(column); > columnWidth = aColumn.getWid... Sure, anyhow I'm moving common methods to `SwingUtilities2 `now and testing...... Will check if your suggestions works fine and let u know... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1400308541