Integrated: 4938801: The popup does not go when the component is removed
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Aug 1 09:19:08 UTC 2025
On Mon, 21 Jul 2025 02:16:27 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> Issue is seen that a popup doesn't get closed when the component that invokes it, gets removed from the parent container.
> This is because the JPopupMenu does not listen to its invoker liefecycle thereby behaving as a standalone entity after creation.
> Fix is made to make sure popup listens to its invoker lifecycle by registering its PropertyChangeListener to the invoker and listens to the ["ancestor" property name ], https://github.com/openjdk/jdk/blob/441dbde2c3c915ffd916e39a5b4a91df5620d7f3/src/java.desktop/share/classes/javax/swing/JComponent.java#L4853-L4858 which will become null when removed, wherein we should dispose of the popup
This pull request has now been integrated.
Changeset: 7fbeede1
Author: Prasanta Sadhukhan <psadhukhan at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/7fbeede14c558221ae0e5b8d65f50e50c0e3737a
Stats: 145 lines in 2 files changed: 144 ins; 0 del; 1 mod
4938801: The popup does not go when the component is removed
Co-authored-by: Alexey Ivanov <aivanov at openjdk.org>
Reviewed-by: dnguyen, abhiscxk
-------------
PR: https://git.openjdk.org/jdk/pull/26407
More information about the client-libs-dev
mailing list