Mega Code Archive
Set the end of the selection; ignored if new end is start
import javax.swing.JTextArea;
import javax.swing.text.JTextComponent;
public class Main {
public static void main(String[] argv) {
JTextComponent c = new JTextArea();
c.setSelectionEnd(20);
}
}