I've been trying to implement a game using a BufferStrategy
within a Canvas
in a JFrame
, and I just can't seem to get my animated .gif
images (implemented as new ImageIcon().getImage()
) to play without flickering.
I think the problem lies with the .gif
refresh rate and the rate at which the canvas is being redrawn, but this is only a guess. I've been trying various things for hours and searching all over the internet for some solution, but one has yet to present itself. Any help would be greatly appreciated.
On a side note, the .gif
works fine. It doesn't flicker in image viewing programs like XnView, and it also played fine as a JLabel
within a super simple JFrame
program.