On Thu, 10 Dec 2020 16:06:00 GMT, Tejpal Rebari <[email protected]> wrote:
>> Please review the following fix for jdk16.
>>
>> Issue : There is a JToggleButton that will post/take down a JPopupMenu when
>> the button is selected. If the button is selected and the menu is not posted
>> the action listener will post the menu. If the button is selected and the
>> menu is displayed the action listener will take the menu down. The use case
>> is:
>> 1 - select button
>> 2 - menu posted
>> 3 - select button
>> 4 - menu taken down
>>
>> With MetalLookAndFeel the above use case works fine, but with
>> WindowsLookAndFeel the second button selection does not fire the
>> actionPerformed event, button needs to be selected third time for the menu
>> to be taken down.
>>
>> The issue is that the button must be selected twice after the menu is posted
>> to have the actionPerformed event to fire when using the Windows look and
>> feel.
>>
>> Fix : MouseGrabber is not removed while uninstalling the listeners in the
>> BasicPopupMenuUI.
>> By removing the mouseGrabber in the uninstallListeners() methods fixes this
>> issue.
>>
>> Added a test to test the same in all the LookAndFeels
>
> Tejpal Rebari has updated the pull request incrementally with one additional
> commit since the last revision:
>
> changed mode of files
src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
line 806:
> 804:
> 805:
> 806: "PopupMenu.consumeEventOnClose", Boolean.FALSE,
This property was added to support some kind of "native" behavior.
The code from the BasicPopupMenuUI.java:
// Ask UIManager about should we consume event that closes
// popup. This made to match native apps behaviour.
boolean consumeEvent =
UIManager.getBoolean("PopupMenu.consumeEventOnClose");
// Consume the event so that normal processing stops.
if(consumeEvent && !(src instanceof MenuElement)) {
me.consume();
}
So after this fix, the mouse event that causes the popup to close will be not
be dispatched to the next component?
-------------
PR: https://git.openjdk.java.net/jdk/pull/600