简体   繁体   中英

Detecting where a change event came from

I have a bunch of JTextComponents that fire update events to a common model. The model then fires out change events to the other components so they can all be in synch. How can I detect which one fired the event initially so as not to fire the event back? I ask this as I'm currently getting an expection due to attemtping to update the component that fired the event.

There should be a getSource method on the event object. Use that to obtain a reference to the component that originally fired the event. You can then skip that component when distributing the event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM