void () { Point caretLocation = visualPositionToXY(getCaretModel().getVisualPosition()); int scrollOffset = caretLocation.y - myCaretUpdateVShift; getScrollingModel().disableAnimation(); getScrollingModel().scrollVertically(scrollOffset); getScrollingModel().enableAnimation(); }