#1 Mousewheel Support for JDK 1.4

open
nobody
None
5
2002-12-20
2002-12-20
Helmut Heidegger
No

This is a patch to have scroll wheel support with JDK 1.4

----cut------

100d99
< painter.addMouseWheelListener(new
ScrollWheelHandler());
1921,1953d1924
<
< class ScrollWheelHandler implements
MouseWheelListener
< {
< /**
< * Invoked when the mouse wheel is rotated.
< * @see MouseWheelEvent
< */
< public void
mouseWheelMoved(MouseWheelEvent e)
< {
< int line_to_scroll_to;
< int units = e.getUnitsToScroll();
<
< line_to_scroll_to = firstLine + units;
< if (units < 0)
< {
< line_to_scroll_to += electricScroll;
< if (line_to_scroll_to < 0)
< {
< line_to_scroll_to = 0;
< }
< }
< else if (units > 0)
< {
< line_to_scroll_to += visibleLines
- 1 - electricScroll;
< if (line_to_scroll_to >=
getLineCount())
< {
< line_to_scroll_to =
getLineCount() - 1;
< }
< }
<
< scrollTo( line_to_scroll_to, 0 );
< }
< }

Discussion