File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Autoscrolling in a JTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Autoscrolling in a JTextField" Watch "Autoscrolling in a JTextField" New topic
Author

Autoscrolling in a JTextField

Matt De
Greenhorn

Joined: Jul 29, 2005
Posts: 5
I am making a chat like client. I want it to auto scroll down to keep up with the text. Right now the text is added but the scroll bar doesn't move. I was looking at some scrollable stuff in the API, but I am still new to java and it is hard for me to find the right methods and stuff for what I want to do. I have programming experience, but am still a little confused on find what I need to accomplish certain tasks in java. Thanks for any help given. I have scrollbars in place already I just need any info on how to make the JTextField scroll along as new text extends past the bottom of my JTextField.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Moving to Swing/AWT...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

setCaretPosition();

Example:
[ July 29, 2005: Message edited by: Steve Morrow ]
Matt De
Greenhorn

Joined: Jul 29, 2005
Posts: 5
Thanks got it to work. I saw something on setCaretPosition but didn't understand it completely. Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Autoscrolling in a JTextField