سؤال

I have developed a snake game in Java. The problem is that I see a flicker while the game is running. Can anyone please inform me why this is happening and direct me to a possible solution?

The code for the game can be found here.

هل كانت مفيدة؟

المحلول

Have you considered double buffering?

Looking at your code, what about the following being a potential cause

Thread.sleep(1000)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top