Itβs difficult for me with the TextArea cursor, it remains at position 0 on the first line, after adding new text to TextArea .
Main problem
I have a TextArea , when I add enough text, a scrollbar appears to add new text below the old one. However, while everything is in order, the cursor in TextArea returns to the top, which becomes annoying when I have frequent inserts in TextArea .
This is how I add a new line every time:
void writeLog(String str) { textArea.setText(textArea.getText() + str + "\n"); }
How can I stop the cursor in TextArea from returning to the first line after each insertion?
source share