int () { Rectangle area = getScrollingModel().getVisibleArea(); VisualPosition begin = xyToVisualPosition(area.getLocation()); VisualPosition end = xyToVisualPosition(new Point(area.x + area.width, area.y + area.height)); return Math.max(myView.getPreferredWidth(begin.line, end.line), getScrollingWidth()); }