how to set scrollbar to the end

hi,

experts.

i have problem to set scroll at the end of the textarea i have to maitain each time scroll bar at the end when i get messages from client,

now a time when the msg. came scrollbar is set to top and i want at the end..

so please help me....

thanx.

jignesh

[309 byte] By [java_tigera] at [2007-10-2 5:28:06]
# 1
sss
java_tigera at 2007-7-16 1:29:46 > top of Java-index,Core,Core APIs...
# 2
aaaa
java_tigera at 2007-7-16 1:29:46 > top of Java-index,Core,Core APIs...
# 3
You should try posting this question in the Swing forum as it is really not RMI related.
carr_onstotta at 2007-7-16 1:29:46 > top of Java-index,Core,Core APIs...
# 4
hi jigneshsomething like myJTextArea.setCaretPosition(myJTextArea.getText().length()) might work.if not, try myJScrollBar.getModel().setValue(myJScrollBar.getMaximum());cicero
ciceroa at 2007-7-16 1:29:46 > top of Java-index,Core,Core APIs...
# 5

Here is solution for vertical scrollbar and JList, but maybe it works and for other components in JScrollPane.

JList list;

...

Rectangle rect = new Rectangle(0, 0, 0, 0);

rect.y = (int)list.getPreferredSize().getHeight();

list.scrollRectToVisible(rect);

ivanholuba at 2007-7-16 1:29:46 > top of Java-index,Core,Core APIs...