Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Drawing an image in Java

Drawing an image in Java
Thread Tools
Mac Enthusiast
Join Date: Jun 2000
Location: New York, NY
Status: Offline
Reply With Quote
Sep 28, 2002, 05:08 PM
 
I'm drawing an image in an applet

I use g.drawImage(img, x,y..... , this);

where this is the applet. It says that for that argument drawImage should take an ImageObserver.

i have a class called Foo and i want to have a draw function and allow foo to draw itself like this...

draw(Graphics g, Image img, .......)

but I need to pass in an ImageObserver. When I try to pass "this" as an imageobserver i get an error.

what am i doing wrong?
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Sep 28, 2002, 06:38 PM
 
If Foo does not implement the ImageObserver interface or extned Component or a subclass of Component then you can't pass this in as the ImageObserver.

But, I suspect that you don't really know what ImageObserver is used for, so you probably don't even need it.

In that case, just do yourself a favor and pass null in as the fourth argument.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:51 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2