| | |
TextArea scroll bar lowest position?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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
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
---------------------------------- Sir Winston Churchill
When I made a chat application I had the same problem. If you had googled a little harder you could have found this solution.
java Syntax (Toggle Plain Text)
//incoming is the JTextField that displays the conversation //doc is a previously initialized Document object. doc = incoming.getDocument(); 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
Sorry guys, I was adding the textArea wrong, thats why it wasn't working.
Original Code:
Correct Code:
Thanks for the replies!
PO
Original Code:
java Syntax (Toggle Plain Text)
add(textArea, borderLayout.NORTH);
Correct Code:
Java Syntax (Toggle Plain Text)
add(scroller, borderLayout.NORTH);
Thanks for the replies!
PO
History will be kind to me for I intend to write it.
---------------------------------- Sir Winston Churchill
---------------------------------- Sir Winston Churchill
![]() |
Other Threads in the Java Forum
- Previous Thread: Print Registry Folder Contents
- Next Thread: Expected output is incorrect!
Views: 942 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android api apple applet application arguments array arrays automation binary block bluetooth chat class classes client code compile component database developmenthelp draw eclipse encode error event exception file fractal freeze game gameprogramming givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie notdisplaying number object online oracle print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing system template test textfields threads time title transfer tree tutorial-sample update windows working






