I believe that createImage() is going to return null until the component is actually on-screen. Doing lazy initialization of the image at the first call to paint() on the event thread would work, but because you're calling paint() yourself (which is rarely the great idea that people always think it is!) you don't actually have a good way to know when that will be, other than trying, sleeping, and trying again.
Moving to the Swing/AWT/SWT/JFace forum for any further discussion.
Notice, for example that the object returned from getGraphics is ignored.
I would suggest that you simplify the code -- there's no need to do this sort of double buffering, because Swing already does double buffering for you! Also, javax.swing.Timer is a better way to drive simple animation.