java - get text from JTextArea by number line
For my case, I want to get 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 get a text in line 3. I think I can use jTextArea.getText(3,jTextArea.getText().length()) , but it doesn't work. so, from line 3, i wish get text number id : 01011990 01 MadProgrammer Simply based on the example from your previous question ... Document doc = textArea.getDocument(); Element root = doc.getDefaultRootElement(); Element element = root.getElement(2); int start = element.getStartOffset(); int