<Swing Dev> RFR: 8048109: JToggleButton does not fire actionPerformed under certain conditions [v4]
Sergey Bylokhov
serb at openjdk.java.net
Fri Dec 18 21:45:58 UTC 2020
On Fri, 18 Dec 2020 07:49:42 GMT, Tejpal Rebari <trebari at openjdk.org> wrote:
>> 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?
>
> Before the fix the mouse event that cause the popup to close was consumed here as the "PopupMenu.consumeEventOnClose" was true.
>
> After the fix the mouse event that cause the popup to close will not be consumed here as "PopupMenu.consumeEventOnClose" is set to false in the fix for Windows, GTK, Nimbus and Motif LAF.
And does it match the native behavior? I mean different values of "consumeEventOnClose" weren't a bug. It was intentionally set to the appropriate value.
-------------
PR: https://git.openjdk.java.net/jdk/pull/600
More information about the swing-dev
mailing list