I have a solution.
My solution is not perfect, but better than no solution.
I changed the Class CefBrowserOsr and the method sendMouseWheelEvent of CefBrowser_N to public.
I also deleted this code from CefBrowserOsr:
- Code: Select all
canvas_.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
browserOsr.sendMouseWheelEvent(e_);
}
});
Then I added these lines of code to my application:
- Code: Select all
CefBrowserOsr browserOsr = (CefBrowserOsr) browser;
Component browserUIComponent = browserOsr.getUIComponent();
browserUIComponent.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
MouseWheelEvent e_ = new MouseWheelEvent(browserUIComponent,
e.getID(),
e.getWhen(),
e.getModifiers(),
e.getX(),
e.getY(),
e.getClickCount(),
e.isPopupTrigger(),
e.getScrollType(),
e.getScrollAmount(),
e.getWheelRotation() * -1);
for (int i=0; i<8;i++) {
browserOsr.sendMouseWheelEvent(e_);
}
}
});
The solution works for me.
Thank you, @magreenblatt and @amaitland for your help!
If you have a better solution, you are free to share it in this thread.
JCEFBeginner