int caret = textArea.getLineStartOffset( Math.max(0,line - visibleLines));
line = Math.max(0,line - visibleLines); caret = textArea.getLineStartOffset(line) + textArea.xToOffset(line,magic + 1);
	public void actionPerformed(ActionEvent evt)	{		View view = getView(evt);		JEditTextArea textArea = view.getTextArea();		int firstLine = textArea.getFirstLine();		int visibleLines = textArea.getVisibleLines();		int line = textArea.getCaretLine();		if(firstLine < visibleLines)			firstLine = visibleLines;		textArea.setFirstLine(firstLine - visibleLines);		int caret = textArea.getLineStartOffset(			Math.max(0,line - visibleLines));		if(select)			textArea.select(textArea.getMarkPosition(),caret);		else			textArea.setCaretPosition(caret);	}