<Swing Dev> [10] RFR JDK-8173739: JPopupMenu does not disappear on KeyEvent

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Tue Jul 4 07:05:04 UTC 2017


OK. Updated webrev to post ungrab from a method when internal frame is 
deselected.

There is no grab event. When popup menu is visible, it grab window in 
BasicPopupMenuUI
public void stateChanged(ChangeEvent e) {
             MenuSelectionManager msm = 
MenuSelectionManager.defaultManager();
             MenuElement[] p = msm.getSelectedPath();

             if (lastPathSelected.length == 0 && p.length != 0) {
                 grabWindow(p);
             }

http://cr.openjdk.java.net/~psadhukhan/8173739/webrev.01/

Regards
Prasanta
On 7/4/2017 12:01 AM, Sergey Bylokhov wrote:
> There are a few questions which should be clarified, because from the first look we should updated some other method.
>
>   - The updated method is protected and have no any information in the specification that it can post ungrab event.
>   - If there are a few listeners then the code will post a few ungrab events. It is also interesting when the grab event is posted?
>
> ----- prasanta.sadhukhan at oracle.com wrote:
>
>> Hi All,
>>
>> Please review a fix for an issue where it is seen that if a popup menu
>>
>> is shown in an internal frame and
>> another internal frame is shown on top of 1st frame, then even though
>>
>> 1st internal frame gets hidden, the popup is still visible.
>>
>> Issue was popup menu was not getting cancelled when the 1st internal
>> frame gets hidden/deactivated.
>> Poprosed fix is to send an UngrabEventwhen the 1st internal frame gets
>>
>> deactivated
>>    so that BasicPopupMenuUI can catch the UngrabEvent and cancel the
>> popupmenu .
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8173739
>> webrev: http://cr.openjdk.java.net/~psadhukhan/8173739/webrev.00/
>>
>> Regards
>> Prasanta




More information about the swing-dev mailing list