Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTextField and PropertyChangeListener

843806Jul 12 2007 — edited Jan 16 2008
I 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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2008
Added on Jul 12 2007
2 comments
271 views