Mouse scroll causes JComboBox popup close

256 views
Skip to first unread message

Jesús

unread,
Jan 26, 2011, 12:41:10 PM1/26/11
to Sea Glass Look and Feel
I have a problem with JComboBox popup. When I use the mouse scroll
wheel the popup disappear.
In my laptop(Mac Os) all work fine but in the other proyect members
system(include another Mac) the problem occurs.
Any solution?
Thanks

Rossi

unread,
Jan 27, 2011, 2:20:16 PM1/27/11
to sea-glass-l...@googlegroups.com
Hello Jesús:

Do you have many items in your popup? Do you have a scroll bar?
I just tried it here under linux if there is not scrollbar displayed then it
is normal that scrolling the mouse wheel closes the popup.
This also happens for Ocean and Nimbus LookAndFeel and the others too I guess.
But if you have a scrollbar and the mouse is over the popup menu then the
scoll events should be consumed by the scrollpane in the popup.

I tested it some more and found out that in the class

BasicPopupMenuUI in the eventDispatched method (line 824)
there is the following code

case MouseEvent.MOUSE_WHEEL:
if (isInPopup(src)) {
return;
}
cancelPopupMenu();
break;
}


The isInPopup(src) seems to fail but I can not debug this because I develop
under Linux and whenever I set a breakpoint that is hit when a Popup is
visible my whole KDE freezes and I have to switch to the console and kill the
Java App so I have no chance to step throu this code.

I hope this gives you a hint on why the popup closes.
Could you set a breakpoint there and step throu the isInPopup method and see
why it does not work as expected?

What is src and why does it not have a JPopup parent?

I would be very interested in your findings as I use seeglass a lot now and I
try to fix all bugs I get aware of.

Have fun,
- Rossi

Rossi

unread,
Feb 19, 2011, 2:52:47 PM2/19/11
to Sea Glass Look and Feel
Hello Jesus,
Finally I found some time to digg into it on a windows machine. On
windows debugging does not freeze the screen when you hit a breakpoint
and a popmenu is visible.

This was a very tricky one. This bug is caused because the mouse wheel
event is not consumed correctly by the scrollpane.
To fix this please do the following.
Open SeaglassScrollPaneUI and go there to the inner Handler class to
method mouseWheelMoved()

Put there at the end of the large if block a e.consumed();

It should be somewhere near

Rossi

unread,
Feb 19, 2011, 2:56:53 PM2/19/11
to Sea Glass Look and Feel
sorry I hit send by accident.

The method end should then look like this:

else if (...) {
scrollByBlock(toScroll, direction);
}
e.consumed(); // <- This is the fix
}
}

Hope this helps. For me it workes.

Have fun,
- Rossi

Kathryn Huxtable

unread,
Feb 19, 2011, 4:54:54 PM2/19/11
to sea-glass-l...@googlegroups.com
So this should be reported as a bug so that we fix it. Right? -K

Rossi

unread,
Feb 20, 2011, 5:37:17 AM2/20/11
to sea-glass-l...@googlegroups.com
Hi,
Yes of course we should. I have opened issue 66 for this as a reference and
fixed this already in the integration branch but not in trunk.

Have fun,
- Rossi

Kathryn Huxtable

unread,
Feb 20, 2011, 9:16:53 AM2/20/11
to sea-glass-l...@googlegroups.com
Great! -K

Jesús Miguel Pérez

unread,
Feb 20, 2011, 5:23:27 PM2/20/11
to sea-glass-l...@googlegroups.com
I try and works fine!
Thank you very much!
Reply all
Reply to author
Forward
0 new messages