On Thu, 26 Oct 2023 10:42:52 GMT, Tejesh R <t...@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: > > Synth update
src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableUI.java line 875: > 873: if( !table.getComponentOrientation().isLeftToRight() ) { > 874: x = getWidthInRightToLeft() - x - > cm.getColumn(column).getWidth(); > 875: } Suggestion: if (column < 0) { if (!table.getComponentOrientation().isLeftToRight()) { x = getWidthInRightToLeft(); } } else if (column >= cm.getColumnCount()) { if (table.getComponentOrientation().isLeftToRight() ) { x = table.getWidth(); } } else { for (int i = 0; i < column; i++) { x += cm.getColumn(i).getWidth(); } if (!table.getComponentOrientation().isLeftToRight()) { x = getWidthInRightToLeft() - x - cm.getColumn(column).getWidth(); } src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableUI.java line 878: > 876: } > 877: return x; > 878: } Suggestion: if (column < 0) { if (!table.getComponentOrientation().isLeftToRight()) { x = getWidthInRightToLeft(); } } else if (column >= cm.getColumnCount()) { if (table.getComponentOrientation().isLeftToRight()) { x = table.getWidth(); } } else { for (int i = 0; i < column; i++) { x += cm.getColumn(i).getWidth(); } if (!table.getComponentOrientation().isLeftToRight()) { x = getWidthInRightToLeft() - x - cm.getColumn(column).getWidth(); } } return x; } test/jdk/javax/swing/JTable/JTableRightAlignmentTest.java line 64: > 62: > 63: public static void main(String[] args) throws Exception { > 64: > UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); Should this test run on all L&F? Since part of the fix occurs in BasicTableUI. test/jdk/javax/swing/JTable/JTableRightAlignmentTest.java line 121: > 119: private static void saveImage(BufferedImage image, String fileName) { > 120: try { > 121: ImageIO.write(image, "png", new File(fileName)); Is it OK to save an image here? In the past, I stored my images similar to in #7310 to store the image in the correct area for temporary images for a test. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1382198457 PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1382202632 PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1382203232 PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1382203747