Sponsored Link •
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
There is a very simple way to force the scroll pane to
So just use:
jTextArea.append( string ); // append the string You want to
The second line does not change the text in the text area but
You can also use
jTextArea.setText( jTextArea.getText() + string );
which is a little bit more effective than the two lines above.
> Move the JScrollPane's vertical scrollBar down after appending the String:
> _pane.getVerticalScrollBar().setValue(_logText.getHeight() - _logText.getVisibleRect().height );
> > _logText.getCaret().setDot( _logText.getText().length() );
> > this.paint(this.getGraphics()); // should use "paintImmediately" but not usable for JDialog in 1.2 (should be in 1.3)
> > where _logText is the JTextArea and and _pane is the JScrollPane using _logText.
> > > Hi,
> > > In the AWT if I create a TextArea and then keep feeding information to that
> > > Is there anyway I can change this?
> > > Thanks a lot,