Here you can find the source of scrollToTop(JTextComponent edit1)
public static void scrollToTop(JTextComponent edit1)
//package com.java2s; //License from project: Open Source License import javax.swing.text.JTextComponent; public class Main { public static void scrollToTop(JTextComponent edit1) { edit1.setCaretPosition(0);/*from w ww. j a va2s . c o m*/ } }