I am trying to get all the line numbers from jtextarea. I though of using the document listener's methods,
public void insertUpdate(DocumentEvent e) {
}
public void removeUpdate(DocumentEvent e) {
}
I am able to get the currently modiefied line number using the above methods, but when it comes to copy paste (multiple lines) i am unable to get the line number, when we paste we get only the intial line number and not the end line number. Any one know how to get the starting as well as the ending line numbers of multiple lines?
If you got the starting line number, you can easily compute the ending one by counting the numbers of '\n' chars in your selected text. endingLineNbr = startingLineNbr + newLinesCount