A JTextComponent
allows you to add a DocumentListener
to its Document
, which will tell you when text was added or removed, and the offset and length of the change. It will not, however, tell you what the text of the change was.
This is not much of a problem for text addition, as you can use the offset and the length to find the added text. However, you can't use it to find the deleted text, as the text is already gone.
Has anyone run into this problem before? How can you get the string that was deleted from a document?