I have been trying to make a text changed event handling mechanism for my JTextArea
. For my purposes an event has to be fired whenever there is a change in the
You are comparing strings with ==
if (currentText == textString)
This will never be true. This compares if the strings are the same String object. You should use equals.
if (currentText.equals( textString) )
You might also want to check out DocumentListeners. See also this How do I compare strings in Java?