The call to this.getGraphics() will return null if the component is not visible (i.e. the panel has been added to a JFrame which is not currently set to visible at the time the thread is running). My guess is that finalGraphics is null at the time finalGraphics.drawImage(bfi,0,0,null); is being called. As far as I know, a call to getGraphics (or the preferred createGraphics as TheChubu pointed out) of a BufferedImage object should not return null.
Also, unless there's a reason you aren't currently, I'd consider using the BufferStrategy class that the Java library provides for double-buffering. See the links below for examples of usage in an active-rendering loop. Hope that helps!
http://docs.oracle.com/javase/tutorial/extra/fullscreen/bufferstrategy.html
http://www.gamedev.net/page/resources/_/technical/general-programming/java-games-active-rendering-r2418
n3oplasm
Member Since 05 Nov 2012Offline Last Active Dec 15 2012 03:58 PM

Find content
Not Telling