Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scroll bar 1

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
Hi,
how can I scroll down until the end of a JScrollPane using the code? Ion Filipski
1c.bmp


filipski@excite.com
 
Try this:

String strMessage = myTextArea.getText();
myTextArea.setCaretPosition( strMessage.length() ); "When you have eliminated the impossible, whatever remains, however
improbable, must be the truth." ~ Arthur Conan Doyle
 
Thanks, but what to do if the textarea is not editable? Ion Filipski
1c.bmp


filipski@excite.com
 
Actually, after doing some testing I found that the above doesn't really work very well. Try doing this:

myTextArea.setText( myTextArea.getText() );

This will force the textArea to scroll up to the end of the text, even if the field is not editable. You can also append to the text at the same time:

myTextArea.setText( myTextArea.getText() + " more text" );

"When you have eliminated the impossible, whatever remains, however
improbable, must be the truth." ~ Arthur Conan Doyle
 
I need a solution what will work not only with textareas. For example there could be a picture in a window. Ion Filipski
1c.bmp


filipski@excite.com
 
use


myScrollPane.getVerticleScrollBar().setValue(myScrollPane.getVerticleScrollBar().getMaximum());


?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top