File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Event overflow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Event overflow" Watch "Event overflow" New topic

Event overflow

Hawk Eye

Joined: Apr 06, 2005
Posts: 2
Another question I had is what strategies have you found useful in handling lots of events. I'm working on a fairly complicated swing application and we continue to add new events to the system. This ends up to the point where the user clicks one button and so many events start flying that it is hard to debug and begins to impact performance. How have you approached this problem?
Scott Delap
Ranch Hand

Joined: Apr 05, 2005
Posts: 73
Events can be trick. One thing I like to do is have application level events so you separate out item loaded from say a mouse clicked event. This causes only the appropriate listeners to listen to the right things instead of having 100 different mouse listeners. Also it may be helpful to have levels of events so that all your events don't propogate everywhere. This usually ties in with some event consolidation logic that will collapse say the last 10 notifies down into one event if many are fired. I've also seen systems that intelligently figure out that events A+B are equivelant to event C and therefore collapse things that way as well.
I agree. Here's the link:
subject: Event overflow
It's not a secret anymore!