I\'ve created a JFrame, with a JTextArea. I would like to scroll down the textarea automatically, after each append. How should I manage it?
I\'ve tried log.se
log.se
Mine is a little simpler and efficient. We set the caret to the length of the text to put it at the end like so.
public void appendText(String str){ txtArea.append(str + "\n"); scrollDown(); } public void scrollDown(){ txtArea.setCaretPosition(txtArea.getText().length()); }