Hello eveybody I have done double buffering in applets but i want to use the technique in an application. When i call getGraphics() on the image it creates a nullPointerException, despite having used createImage(width, height) to create an offscreen image. Is it possible to use this method in an application, if so how? thanks
getGraphics() is a method of Component, not Image. You normally call it on the Frame/Canvas or whatever youre working on. Double buffering should work the same in an application as it does in an applet, as far as I know.
Ed, Where are you calling getGraphics() and createImage()? You have to do these when the component you are getting them from is already displayed (i.e. has a Graphics object associated with it)... You get a NullPointerException is you do these in the wrong place. HTH, -Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.