I use PropertyChangeListener
for JTextFields
to listen for value change, and it works normally, and when I use it with JTextArea
; no errors in the code and it is compiled normally. However this method shows response when some change occur in a JTextField
text value but no response when it comes to JTextArea
.
This is how I wrote the code
Inside the constructor:
textField_1.addPropertyChangeListener("value", new ChangeListener());
textField_2.addPropertyChangeListener("value", new ChangeListener());
textArea.addPropertyChangeListener("value", new ChangeListener());
And somewhere inside the class:
private class ChangeListener implements PropertyChangeListener
{
@Override
public void propertyChange(PropertyChangeEvent e)
{
Object source = e.getSource();
if ((source == textField_1) || (source == textField_2) || (source == textArea))
{
System.out.println("some value changed "+ source.getClass());
}
}
}
I use new value each time I make a change to these compomemts text value.
THanks
use DocumentListener for listening of changes in JTextArea
from this Listener you can to fire a new event to PropertyChangeListener
fire a new event to PropertyChangeListener
only in the case thats required, no idea from this description, for better help sooner post an SSCCE