TextArea scroll bar lowest position?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: May 2008
Posts: 129
Reputation: PhiberOptik is an unknown quantity at this point 
Solved Threads: 4
PhiberOptik's Avatar
PhiberOptik PhiberOptik is offline Offline
Junior Poster

TextArea scroll bar lowest position?

 
0
  #1
Mar 20th, 2009
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
History will be kind to me for I intend to write it.
---------------------------------- Sir Winston Churchill
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 808
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Practically a Posting Shark

Re: TextArea scroll bar lowest position?

 
0
  #2
Mar 20th, 2009
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...
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 3,584
Reputation: jasimp has a spectacular aura about jasimp has a spectacular aura about jasimp has a spectacular aura about 
Solved Threads: 52
Featured Poster
jasimp's Avatar
jasimp jasimp is offline Offline
Senior Poster

Re: TextArea scroll bar lowest position?

 
0
  #3
Mar 20th, 2009
When I made a chat application I had the same problem. If you had googled a little harder you could have found this solution.
  1. //incoming is the JTextField that displays the conversation
  2. //doc is a previously initialized Document object.
  3. doc = incoming.getDocument();
  4. incoming.setCaretPosition(doc.getLength()-1);
Last edited by jasimp; Mar 20th, 2009 at 6:34 am.
"Argyou not with the hand you are dealt in cards or life." ---- Wizard and Glass
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 129
Reputation: PhiberOptik is an unknown quantity at this point 
Solved Threads: 4
PhiberOptik's Avatar
PhiberOptik PhiberOptik is offline Offline
Junior Poster

Re: TextArea scroll bar lowest position?

 
0
  #4
Mar 20th, 2009
Sorry guys, I was adding the textArea wrong, thats why it wasn't working.

Original Code:
  1. add(textArea, borderLayout.NORTH);

Correct Code:
  1. add(scroller, borderLayout.NORTH);

Thanks for the replies!
PO
History will be kind to me for I intend to write it.
---------------------------------- Sir Winston Churchill
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum


Views: 942 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC