So in the game I\'m working on, I have a marble follow the mouse, but when it does this the screen flickers.
The background includes two jpegs and 9 rectangles. How
Swing supports double buffering automatically, so you don't need to code anything.
Just call setDoubleBuffered(true) on your top-level component (typically a JPanel) and it should all work.
setDoubleBuffered(true)
See: setDoubleBuffered