<Swing Dev> [11] Review Request: JDK-4334792: Lead Index in DefaultListSelectionModel will never return to -1
Pankaj Bansal
pankaj.b.bansal at oracle.com
Fri Feb 16 05:36:37 UTC 2018
Hi All,
Please review the fix for JDK 11.
Bug:
https://bugs.openjdk.java.net/browse/JDK-4334792
webrev:
http://cr.openjdk.java.net/~pbansal/4334792/webrev.00/
Issue:
Lead Index in DefaultListSelectionModel will never return to -1 in some cases as described.
Fix:
1) JList.setSelectionIndex(-1)
The doc says JList.setSelectedIndex() should select a single cell, but it doesn't mean it should clear selection if the argument is -1.
This will also not be fixed as this is not an issue and behavior is expected.
2) JList.clearSelection()
The proposed fix addresses this issue.
3) ListModel.removeAllElements()/ListModel.clear
This issue has been addressed already except the case when the lead/anchor is 0/0 and then JList.removeAllElements/ListModel.clear is called, then the anchor/lead is not set properly. This case is addressed in the proposed fix. This will also fix the https://bugs.openjdk.java.net/browse/JDK-6481195
4) ListSelectionModel.setLeadSelectionIndex()
This is not an issue as lead can be set to -1 by setLeadSelectionIndex, if the anchor is already set properly. This is expected behavior and will not be changed.
Regards,
Pankaj Bansal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180215/b1259255/attachment.html>
More information about the swing-dev
mailing list