JTextPane problem

Hello.I have a Jtextpane that will be filled with a lot of data in

my application.People insert text and then it's saved in a database.

The problem is when there is a lot of data in the Textpane and

it is refreshed it always displays itself at the end(bottom),not at the

beginning (Top)..

How can I make it that when it's refreshed it automatically scrolls to the top?

Any help appreciated.

Heres some relevant code:

public JTextPane Tarea = new JTextPane();

public JScrollPane scrollpane1 = new JScrollPane(Tarea);

ResultSet rs = select.executeQuery(selectstring);

while (rs.next()) {

String ap2 = rs.getString("data");

Tarea.setText(ap2);

}

[746 byte] By [Java_chicka] at [2007-10-2 21:52:13]
# 1
I'm not that familiar with JTextPanes, but for JTextAreas you would call setCaretPosition(0).
Torgila at 2007-7-14 1:08:07 > top of Java-index,Desktop,Core GUI APIs...
# 2
That solved the problem.That saved a lot of time.Thanks
Java_chicka at 2007-7-14 1:08:07 > top of Java-index,Desktop,Core GUI APIs...
# 3
You are welcome.
Torgila at 2007-7-14 1:08:07 > top of Java-index,Desktop,Core GUI APIs...