This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Question about Graphics drawImage method
Posted by Matt Gerrans on November 24, 2001 at 7:00 PM
You must create a class which implements the interface, just as you do with even listeners (usually with inner classes).
> One of the signatures for the graphics method drawImage is
> drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
> My question is: how am I supposed to have an ImageObserver object that I pass as a parameter when ImageObserver is an interface and can't be instantiated? When I try to create an ImageObserver object (as an instance var), i get the message that the interface is abstract and can't be instantiated. So how do I pass an ImageObserver object to the drawImage method?