Did you add a System.out.println(...) to see if the code is being executed? This is a basic debugging technique to see if the code is executing as you expect.
The changedUpdate(...)
method is invoked when you change an attribute of the text.
I suspect you want to implement the other DocumentListener methods so you will be notified when the "text" in the Document changes. Read the section from the Swing tutorial on How to Write a DocumentListener for more information and working examples.