0

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..)

1
  • 3
    Could you please give us some of the code you used that reproduces the issue you're having? It would greatly help us helping you :) Maybe you could post some SSCCE?
    – ccjmne
    Jan 7, 2014 at 10:02

1 Answer 1

1

With MouseWheelEvent e, you should add the following:

e.consume();

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.