Re: JMenu holding JButton instances - bug with 5.0?



On 4/26/2005 at 4:51:36 AM, allen@xxxxxxxxxxxxxxxxx wrote:

> In the past I have had reasons for adding JButton (and JCheckBox)
> instances to a JMenu's popup. This has worked successfully prior to
> 5.0. Now with 5.0 it seems the buttons and checkboxes get stuck when
> clicked, with no indication of what went wrong. They get stuck before
> their action listeners are even called.

Popups have always been a problem area with Swing. The event handling
seems to change with each new Java version, and code that depends on
anything that is not well-documented and commonly used sometimes breaks.

The difficulties have mostly dealt with focus: giving the focus to another
window does not work consistently across platforms and sometimes popups
must be shown in another window. As a result, popup menus do not actually
get the focus; events are delivered to the parent window and then are
retargetted to the popup.

I cannot think of any reason that mouse handling should be affected by
this. However, I suspect that the complexity of the event handling is
the root cause.

--
Regards,

John McGrath
.