Here you can find the source of setCaretPosition(JTextArea ta)
public static void setCaretPosition(JTextArea ta)
//package com.java2s; //License from project: Apache License import javax.swing.JTextArea; public class Main { public static void setCaretPosition(JTextArea ta) { ta.setCaretPosition(ta.getDocument().getLength()); }// www .j a v a2 s . c om }