My client is complaining that JComboBox popups often close when the scroll is being used over a JComboBox popup with no vertical scrollbar. (He seems to accidently use scrolling over it because he is using an Apple Magic Mouse.)
Any way to prevent this to happen ?
I know it has to do with the ComboBoxUI, but I would like a few pointer where to start. BasicComboPopup.handler is private (not reusable) and I don’t see any code relative to any a MouseWhellListener in BasicComboPopup.
As seen in the source,
BasicPopupMenuUIcontains a nested class,MouseGrabber, that implements theAWTEventListenerinterface. The receipt ofMouseEvent.MOUSE_WHEELineventDispatched()cancels the popup as a function ofisInPopup(). I know of no simple way to defeat the behavior.Empirically, this example invokes
show()from theactionPerformed()handler of aJButton; mouse wheel events are ignored. This might be a reasonable alternative for your user, perhaps combined with a suitableActionEventmodifier mask.In contrast, this example invokes
show()in response toisPopupTrigger()in aMouseAdapter; as expected, mouse wheel events cancel the popup.