How to autoscroll JScrollPane to bottom?

I am wondering what is the best way to autoscroll a JScrollPane to the bottom. Inside the JScrollPane is a JTextArea with lots of text.
LVL 17
Thomas4019Asked:
Who is Participating?
 
sciuriwareConnect With a Mentor Commented:
Simplest if without preparing:

  JTextArea a;

....................


    a.setCaretPosition(a.getText().length());

// Otherwise it is sensible to keep track of the area's contents.

;JOOP!
0
 
sciuriwareCommented:
Use .setCaretPosition(int size);

;JOOP!
0
 
Thomas4019Author Commented:
I have tried other ways such as scrollRectToVisible(), but this is the easiest and the best. Thanks!
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
sciuriwareCommented:
:)))
0
 
vaseembariCommented:
what if i want to scroll through image..
0
 
sciuriwareCommented:
Use the sliders .........................
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.