On Wed, 19 Mar 2025 06:19:07 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/JTable.java line 2162: >> >>> 2160: } >>> 2161: >>> 2162: private void selectColumns(TableColumnModel columnModel, int >>> columnCount) { >> >> Should we check whether column selection is allowed before selecting >> columns? Because by default only row selection is enabled. > > No, as told earlier, selectAll selects all cells... > WHere do you see only row selection is enabled? In SwingSet2 JTable, if you > do ctrl+A which is equivalent to selectAll, all cells gets selected.. [Here](https://github.com/openjdk/jdk/blob/577ede73d8e916bac9050d3bee80d2f18cc833a7/src/java.desktop/share/classes/javax/swing/JTable.java#L5629) >> src/java.desktop/share/classes/javax/swing/JTable.java line 2188: >> >>> 2186: } >>> 2187: if (rowCount > 0 && columnCount > 0) { >>> 2188: selectRows(selectionModel, rowCount); >> >> Any reason for passing selectionModel(s) as parameters ? Anyhow they are >> class variables and can be used directly right ? > > Yes, good catch..we need to use local variable as done in old code and not > modify the class variables..Modified to store the instance variable in local > and use that.. I didn't mean that, I meant the other way. This would still modify the class variable right? And why do you want to use local variable ? Since you are getting selectionIndex, I don't think local variable would be helpful here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24025#discussion_r2002625512 PR Review Comment: https://git.openjdk.org/jdk/pull/24025#discussion_r2002629941