Rob Spoor wrote:It actually shouldn't. You create that Iterator once, when you create the ActionListener. The timer calls actionPerformed which does not create a new Iterator, it only calls the hasNext and next methods.
You're right, I misread the code. Not wanting to make excuses, but conventional code formatting with some vertical whitespace would have aided readability.
Sorry, Jason.
The problem appears to be in your
main(...) method where you construct not one, but two instances of the class. One is made visible but the other is
start()ed.
Also, all Swing code should be executed on the EDT. If you're not familiar with that, find the Oracle tutorial on
Concurrency in Swing and go through it.