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