| Author |
Universal way to detect field changes?
|
Phil Chuang
Ranch Hand
Joined: Feb 15, 2003
Posts: 251
|
|
Now, maybe this is just me, but I thought that the main field components (JTextField, JTextArea, JCheckBox, JComboBox, etc.) would've had some sort of addValueChangeListener method, that catches all data value modifications to the field - like changes to the text field, checkbox checked/unchecked, etc. But there isn't any such thing. I've tried using ActionListener, KeyListener, ChangeListener, ItemListener, PropertyChangeListener, etc., but none of them do the trick. The closest thing I can do is use a FocusListener that compares entry/exit data values. Is there any way I can get a listener that fires immediately upon value changes?
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15229
|
|
You need to use a DocumentListener for this. Something like this: hth [ September 09, 2004: Message edited by: Gregg Bolinger ]
|
 |
Phil Chuang
Ranch Hand
Joined: Feb 15, 2003
Posts: 251
|
|
|
What do you suggest for JComboBox, or other non-Text fields?
|
 |
 |
|
|
subject: Universal way to detect field changes?
|
|
|