For my case, I want to insert text inside JTextArea by number line.
For e.g
name : andy
birth : jakarta, 1 jan 1990
number id : 01011990 01
age : 26
study : Informatics engineering
So, I want to insert text in last position in line 3.
I think I can use:
jTextArea.getDocument.insertString(3," my text here".null);
but it doesn't work.
So, I wish my output to be like this.
name : andy
birth : jakarta, 1 jan 1990
number id : 01011990 01 my text here
age : 26
study : Informatics engineering
You can use the Element#getElement(int) method: