RFR: 4466930: JTable.selectAll boundary handling [v7]

Abhishek Kumar abhiscxk at openjdk.org
Thu Mar 20 07:46:11 UTC 2025


On Wed, 19 Mar 2025 13:49:29 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> JTable.selectAll doesn't do anything if there are no rows or no columns. 
>> But it should still select all columns if there are no rows and the other way round. 
>> It is seen that isColumnSelected() will return false for all columns after calling selectAll() if there happened to be no rows.
>> 
>> Fix is made to select all columns even if there are no rows and similarly for rows if there are no columns.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add check for rowselection and columnselection

src/java.desktop/share/classes/javax/swing/JTable.java line 2192:

> 2190:             selectColumns(columnCount);
> 2191:         } else if (rowCount > 0 && columnCount == 0) {
> 2192:             if (getRowSelectionAllowed()) {

`getRowSelectionAllowed()` condition check can be merged into else if.

src/java.desktop/share/classes/javax/swing/JTable.java line 2196:

> 2194:             }
> 2195:         } else if (columnCount > 0  && rowCount == 0) {
> 2196:             if (getColumnSelectionAllowed()) {

`getColumnSelectionAllowed()` condition check can be merged into else if.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24025#discussion_r2004989869
PR Review Comment: https://git.openjdk.org/jdk/pull/24025#discussion_r2004990315


More information about the client-libs-dev mailing list