I have a class PanouAddContoriMetro with
jtfSeria.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
// do something
}
}
working when called from PanouAddContoriMetro class : jtfSeria.setText("Test");
but not working when I change the property from another
class (PanouExpAutorizatii) : pacm.jtfSeria.setText("Test");
I think the problem here is that you think a
PropertyChangeListener
will listen tosetText()
- It doesn't. In the documentation of thepropertyChange
method it states:Furthermore in the
setText
method's documentation:So, here is an example using a
DocumentListener
. Everything appearing gray in the log was fired by thePropertyChangeListener
, everything black by theDocumentListener
: