aspose file tools
The moose likes Beginning Java and the fly likes double buffering in applications Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "double buffering in applications" Watch "double buffering in applications" New topic
Author

double buffering in applications

Ed Langley
Greenhorn

Joined: Feb 10, 2001
Posts: 4
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
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
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.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: double buffering in applications
 
Similar Threads
flickr game
Problem with writing code.
cursor mouse trails for applets
Accessing Swing widgets while double buffering
Double Buffering