aspose file tools*
The moose likes Applets and the fly likes Draw Image from inside separate class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Draw Image from inside separate class" Watch "Draw Image from inside separate class" New topic
Author

Draw Image from inside separate class

Pedro Cerrano
Greenhorn

Joined: Nov 07, 2004
Posts: 1
Hi,

I'm having a problem trying to draw an image that is stored inside a separate class. In the paint method, I am trying to do something like below.

public void paint(Graphics g)
{
myClass.drawMe(g);
}
-this calls a method for my class
Inside the drawMe method of the myClass class, it would go something like this.

public void drawMe(Grahpics g)
{
g.drawImage(createdImage, xPos, yPos, this);
}

The problem is that 'this' will refer back to the class, not the image object that I need for the ImageObserver. In other words, it gives me an error because 'this' does not meet the ImageObserver parameter because it is inside of a separate class. Is there something I can replace 'this' with so that I will be pointing to the right kind of object and be able to draw the image from inside the class's draw method?

Thanks for the help.

-Pedro
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Draw Image from inside separate class