RFR: 8371657: [macosx] Programmatically selecting/deselecting List item triggers an ItemEvent [v3]
Sergey Bylokhov
serb at openjdk.org
Sat Nov 29 23:26:46 UTC 2025
On Fri, 28 Nov 2025 20:03:34 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>Scrolling means exactly this: move the visible area so that the item at the index becomes visible; this implies other items will become invisible.
No that is not, there is nothing related to the scrolling in the spec of makeVisible:
`Makes the item at the specified index visible.`
That spec can be implemented in a different ways.
> In this test, getSelectedIndexes would return an array that contains [0, 1, …, list.getItemCount() -1], in other words all the indexes of the items in the list.
Just check the spec of the getSelectedIndexes method: it contains the list of selected indexes, not the actual selected items. This is why notifications are sent when the add/delete methods are executed, even if the added or deleted items are not selected. It is possible that makeVisible will delete all items before the visible region and then add them at the end, which will trigger notifications even though this is only an intermediate operation.
>>To do this, it only needs to update the current L&F. List.makeVisible() spec allows this.
>I don't understand what you mean here, either.
You do not believe it is possible to implement a JList.ensureIndexIsVisible() in a ui delegate using add/delete in some L&F?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28245#discussion_r2573245958
More information about the client-libs-dev
mailing list