/**
* Called by a Scrollable object such as JTable or JList, when its state
* changes in such a way that it may need to be scrolled.
*/
public void scroll(ScrollEvent e_) {
Scrollable scrollable = e_.getScrollable();
int direction = e_.getDirection();
/*
* "limit" gives the row and column of the view component that must
* appear just inside the JViewport after scrolling.
*/
Point limit = e_.getLimit();
/*
* Determine the value of "limit" relative to the top left corner of
* the JScrollPane.
*/
Point viewportLocation = getViewport().getLocation();
limit.translate(viewportLocation.x, viewportLocation.y);
limit.translate(scrollable.getLocation());
/*
* Get the bounding rectangle of the child viewport, relative to the
* top left corner of the JScrollPane.
*/