0

Hi Guys!

I am trying to get a scroll bar to go to the lowest position possible. I am using a chat program and it bothers me that I have to scroll down to see new messages! I googled around and found lots of answers for flash, and other languages but nothing that helped me !

THanks PO

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by PhiberOptik
0

Is your chat window in Java? If so is your GUI written in swing or awt? Perhaps some code to describe how you construct your window would help...

0

When I made a chat application I had the same problem. If you had googled a little harder you could have found this solution.

//incoming is the JTextField that displays the conversation
//doc is a previously initialized Document object. 
doc = incoming.getDocument();
incoming.setCaretPosition(doc.getLength()-1);
0

Sorry guys, I was adding the textArea wrong, thats why it wasn't working.

Original Code:

add(textArea, borderLayout.NORTH);

Correct Code:

add(scroller, borderLayout.NORTH);

Thanks for the replies!
PO

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.