The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 How to Write a Custom Swing Component
Subject:  fireStateChanged
Date:  2007-02-23 04:37:40
From:  tomgibara


This article, and ones like it are excellent since they teach programmers who are unfamiliar with a domain its idioms, by definition the hardest thing to identify from source code or documentation. I do have one small correction though, the reverse iteration you specify for the fireStateChanged method is not necessary for ensuring that a listener may be removed during event broadcasting - even if it was, it wouldn't work reliably.

I can only imagine that this particular pattern of doing things within Swing has simply propagated by being repeatedly copied from the Javadocs for EventListenerList. The original reason for implementing a reverse iteration was probably as an optimisation. If so, it almost certainly wasn't worth it then and isn't worth it now.


 Feed java.net RSS Feeds