I'm trying to add a JScrollPane
with a custom component in it to a JPopupMenu
. It works perfectly, it also shows the vertical scroll bar when needed. But when I try to scroll using the mouse wheel, the popup menu disappears.
Anybody got an idea?
(If it's possible I want to use a JPopupmenu
, because it is well integrated into the different OS. I know I can build a Window on my own which looks like a popup menu, but it is too much workaround..)
With
MouseWheelEvent e
, you should add the following:to "consume this event so that it will not be processed in the default manner by the source which originated it."
It worked for me.