JTextField and PropertyChangeListener
843806Jul 12 2007 — edited Jan 16 2008I have a problem with the JTextField and hooking a PropertyChangeListener to the "text" property:
JTextField field = new JTextField();
field.addPropertyChangeListener("text", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
System.out.println("changed...");
}
});
field.setText("testing");
I have also tried the route of implementing a PropertyChangeListener interface to the class but have the same problem...
I am getting no responce at all. This was listed as a bug with java 1.4 but the bug was fixed and close as off java 5. Also, in a previous forum message it was suggested to use a DocumentListener....BUT what is wrong with this code?
Can anybody spot the problem?
Thanks in advance!