<Swing Dev> [11] Review Request: JDK-4334792: Lead Index in DefaultListSelectionModel will never return to -1
Semyon Sadetsky
semyon.sadetsky at oracle.com
Fri Feb 16 15:29:12 UTC 2018
You've already sent this change in 6481195 review. Please continue in
6481195 tread. The current bug should be closed as duplicate.
On 02/15/2018 09:36 PM, Pankaj Bansal wrote:
>
> 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/
> <http://cr.openjdk.java.net/%7Epbansal/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/20180216/af0bef96/attachment.html>
More information about the swing-dev
mailing list