Position of scrollBar in JScrollPane

I have the same problem whit my JScrollPane!!!

My code is:

START CODE

BufferedReader in = new BufferedReader(new FileReader(fileUrl));

String str;

JTextArea textArea = new JTextArea();

while ((str = in.readLine()) != null) {

textArea.append(str);

textArea.append(System.getProperty("line.separator"));

}

in.close();

JScrollPane scrollPane = new JScrollPane(textArea);

getContentPane().add(BorderLayout.CENTER, scrollPane);

--END CODE

The ScrollPane is displyed whit the ScrollBar at the last line.

PS: I use this JScrollPane in one JDialog Component.

{

JDialog dialog = new JDialog();

dialog.add()

}

please...help me bye

[747 byte] By [drumskra] at [2007-11-26 19:16:20]
# 1
textArea.setCaretPosition(0);after the code.regards,Stas
StanislavLa at 2007-7-9 21:29:18 > top of Java-index,Desktop,Core GUI APIs...
# 2
Thank you very much...I solve my problemregards
drumskra at 2007-7-9 21:29:18 > top of Java-index,Desktop,Core GUI APIs...