I'm writing a Java simulation of a physical system. I wrote the whole simulation without any problems and later decided to add very simple GUI to paint the current sate of the system after each iteration.
This is where the first problem occurred. After creating my JFrame and JPanel I called the repaint() method after each iteration. The program seemed to work but Exceptions kept coming up:
Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
When I replaced the repaint() method with paintImmediately(x,y,width,length) the problem no longer occurs but it makes the simulation quite slow...
And I have an analogical problem with a text field.
I crated a JTextField in my panel and call the setTest(String s) after each iteration. And here again I get the same errors... These errors don't crash my simulation but obviously I doing something wrong. Thanks for any tips =)