Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to autoscroll JScrollPane to bottom?

Posted on 2009-04-15
6
Medium Priority
?
1,405 Views
Last Modified: 2013-12-22
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.
0
Comment
Question by:Thomas4019
  • 4
6 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 24154635
Use .setCaretPosition(int size);

;JOOP!
0
 
LVL 24

Accepted Solution

by:
sciuriware earned 2000 total points
ID: 24154643
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
 
LVL 17

Author Closing Comment

by:Thomas4019
ID: 31570816
I have tried other ways such as scrollRectToVisible(), but this is the easiest and the best. Thanks!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 24

Expert Comment

by:sciuriware
ID: 24177994
:)))
0
 

Expert Comment

by:vaseembari
ID: 25748165
what if i want to scroll through image..
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 25748441
Use the sliders .........................
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month20 days, 17 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question