I implement DocumentListener for JEditorPane ( need help with method insertUpdate(DocumentEvent e) ). How to read last word or last line (lines are separated by '\n' and words are separated by ' ' ) ?
How to read last word or last line in DocumenListener
1k Views Asked by Damir At
2
To get the last line in your JEditorPane, split the text in the editor on
\n
as shown below:Similarly, to get the last word, split the last line on space.