Sign up ×  I'm in the process of trying to get familiar with
making games in Java, using the Swing library.  Coding my Snake
game however, I've got to a point where the game is
flickering/ghosting and I haven't a clue why.  An example of the
flickering can be seen on this short youtube video:  I dread to
post too much code here as it won't help anyone, but for
glancers, I'll post some facts.    • Painting on a JComponent
• I do call super.paintComponent(g) at the start of my
overrriden paintComponent method   • I've set
setDoubleBuffered(boolean) to true.   • Although unsure of its
necessity, I've invoked createBufferStrategy(2) on my JFrame   •
My "game loop" is based on a swing.Timer calling repaint every
17ms, but tried, 30fps   • Snake piece moves at 25 pixel paces
(or relative to world size).  This is how I draw each tile:
for (int i = 0; i < gamePieces.length; i++) {         int x = i
% ROW_COL_SIZE;         int y = i / ROW_COL_SIZE;          if
(gamePieces[i].equals(Tile.EMPTY)) {          } els