RFR: 4938801: The popup does not go when the component is removed. [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Jul 25 05:18:56 UTC 2025
On Thu, 24 Jul 2025 19:17:05 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/JPopupMenu.java line 961:
>>
>>> 959: popup.dispose();
>>> 960: popup = null;
>>> 961: }
>>
>> This doesn't work for me on Windows.
>>
>> Well, the test passes because `jpm.isVisible()` returns `false` since `popup` is set to `null`:
>>
>> https://github.com/openjdk/jdk/blob/4e53a9d9dfe7a1ac7c3d7402e5ca3a3d3fcbb709/src/java.desktop/share/classes/javax/swing/JPopupMenu.java#L881-L883
>>
>> But the popup itself remains on the screen.
>
> All you have to do is call `setVisible(false)` (possibly ensuring that `isVisible()` returns `true` first).
>
> This will hide the popup menu and fire the relevant events which aren't sent now… and popup remains on the screen.
Hmm..that is strange..it used to work I am sure..let me check..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26407#discussion_r2230157214
More information about the client-libs-dev
mailing list