<AWT Dev>  Review Request: JDK-8032872: [macosx] Cannot select from JComboBox in a JWindow
dmitry.markov at oracle.com
Mon Mar 3 01:45:24 PST 2014
The current implementation of LWWindowPeer.getOwnerFrameDialog() may
return an instance of Frame or Dialog. The returned value used to check
whether the grabbingWindow is owner of mouse event target or not.
If JComboBox is added to JFrame, the grabbingWindow is JFrame and
getOwnerFrameDialog() returns the same JFrame object, (i.e. the check
If JCombobox is added to JWindow which is owned by JFrame, the
grabbingWindow is JWindow but getOwnerFrameDialog() returns the JFrame,
(i.e. the check fails).
In other words the current implementation assumes that the
grabbingWindow must be an instance of Frame or Dialog and does not
handle the case when the grabbingWindow is JWindow.
On 03/03/2014 13:01, Sergey Bylokhov wrote:
> Hi, Dmitry.
> Why the problem is reproduced in JWindow? Why it works in JFrame?
> On 3/3/14 10:40 AM, dmitry markov wrote:
>> Could you review the fix for jdk9, please?
>> bug: https://bugs.openjdk.java.net/browse/JDK-8032872
>> webrev: http://cr.openjdk.java.net/~dmarkov/8032872/jdk9/webrev.00/
>> Problem description: It is impossible to make a selection in
>> JComboBox added to JWindow via the mouse. The problem is caused by
>> incorrect mouse events handling in LWWindowPeer class. When
>> LWWindowPeer receives a mouse event intended for a popup window, it
>> checks whether the current grabbingWindow is owner of the popup using
>> getOwnerFrameDialog() method. This approach always fails for the
>> JComboBox added to JWindow. As a result an UngrabEvent is send to the
>> popup window.
>> Fix: Introduce new private method
>> LWWindowPeer.isOneOfOwnersOf(LWWindowPeer peer). The method will be
>> invoked on grabbingWindow object to test whether it is owner of
>> current mouse event target or not. The usage of getOwnerFrameDialog()
>> should be replaced by isOneOfOwnersOf() in
>> LWWindowPeer.notifyMouseEvent() and LWWindowPeer.NotifyNCMouseDown().
More information about the awt-dev