ScrolledComposite and the Mouse Wheel
3. October 2006
When using a ScrolledComposite, I always had the problem, that I couldn't use the wheel of my mouse for vertical scrolling. I was really annoyed about it. But now I have found a really simple solution.
Source Code
JAVA:
-
final ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL);
-
sc.addListener(SWT.Activate, new Listener() {
-
sc.setFocus();
-
}
-
});


I had the same problem and the same solution. However, scrolling is *very* slow in my composite if it is used this way, compared to “native” JFace viewers like the TreeViewer. Do you happen to know of a remedy?
-phil
Comment by Phil — 12. April 2007 @ 09:26
This snippet should enable scroll 3 times faster:
sc.getVerticalBar().setIncrement(sc.getVerticalBar().getIncrement()*3);
Tomas
Comment by Tomas Krecmer — 24. April 2007 @ 10:37
Thanks, this tip helped me out.
Comment by Rob — 15. May 2008 @ 20:01
@Tomas Thank you very much for the tip!
Comment by thSoft — 30. September 2009 @ 14:56
You’re the man, man!
Comment by Pierre — 2. June 2010 @ 15:44