Ok, very weird things happening. First of all, I’ve changed this line
repaint();
to this
paint(this.getGraphics());
And the flickering is gone.
And in the main class
public class Game {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new GamePanel());
frame.setResizable(false);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
Changing the setResizable from a line to another determines the flickering too. Wow, I’ve found this by trial and error, am I supposed to find documentation about that?
@sirkarpfen: How do you buffer the graphic object?