RFR: 4938801: The popup does not go when the component is removed. [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Jul 22 03:08:25 UTC 2025


On Mon, 21 Jul 2025 17:17:55 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/JPopupMenu.java line 947:
>> 
>>> 945:             public void propertyChange(PropertyChangeEvent e) {
>>> 946:                 String propertyName = e.getPropertyName();
>>> 947:                 if (propertyName == "ancestor") {
>> 
>> Just curious, where is the `ancestor` property added to the listener list? I have tried tracking this down to follow the logic, and I could not find it, nor can I find it under the bound properties list on javadoc.
>> 
>> Testing seems to be ok AFAIK but I wanted to trace the code to double-check.
>
> The changes to the `ancestor` property are fired from `JComponent.addNotify` and `removeNotify` correspondingly:
> 
> https://github.com/openjdk/jdk/blob/9dd93c6a2c5fb4c3a9f2a063a7ab402f9292ad03/src/java.desktop/share/classes/javax/swing/JComponent.java#L4837
> 
> https://github.com/openjdk/jdk/blob/9dd93c6a2c5fb4c3a9f2a063a7ab402f9292ad03/src/java.desktop/share/classes/javax/swing/JComponent.java#L4858

Guess  I already mentioned in the description

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26407#discussion_r2220906005


More information about the client-libs-dev mailing list