Hi Daniel,
It was a good suggestion to use flushGraphics instead. Unfortunately it worked just as bad.
Now (after about 30 seconds) flushGraphics throws a Throwable instead. And every once in a while getGraphics throws a Throwable.
So in the end I get almost exactly the same behavior as when using serviceRepaints.
I also have some try-catch blocks in there. But besides that, this is pretty much what my code looks like;
public void run() {
do {
//* a short delay
//* update stuff for animation
Graphics g = getGraphics();
paint(g);
flushGraphics();
} while(!paused);
}
The old version with serviceRepaints (which I much rater use since I’ve tested it on many devices) lookes something like this;
public void run() {
do {
//* a short delay
//* update stuff for animation
repaint();
serviceRepaints();
} while(!paused);
}
Thanks,
Petrus