Hi Pankaj,

Clearing current selection each time the selection mode is changed could be a good solution for the issue but this may cause compatibility problems in existing applications.

I'd suggest you try to preserve the consistent part of the current selection, at least the topmost single row.

--Semyon


On 09/26/2017 11:17 PM, Pankaj Bansal wrote:

Hi All,

Please review the fix for JDK 10.

Bug:

https://bugs.openjdk.java.net/browse/JDK-6463710

Webrev:

http://cr.openjdk.java.net/~aghaisas/pankaj/6463710/webrev.00/ <http://cr.openjdk.java.net/%7Eaghaisas/pankaj/6463710/webrev.00/>

Issue:

ListSelectionModel.setSelectionMode() or JList.setSelectionMode() does not change the selection and leaves the selection in inconsistent state. This bug will affect the JList and JTable as they both use ListSelectionModel. The JTree uses it indirectly through TreeSelectionModel which handles it.

Fix:

Made changes in ListSelectionModel to check if the selectionMode has changed and if yes, clear the selection.

Made changes in JList to make it consistent with JTable.

Added a test program to test the functionality for ListSelectionModel.setSelectionMode()

Regards,

Pankaj Bansal


Reply via email to