Re: Displaying image in applet
Re: Displaying image in applet
- Subject: Re: Displaying image in applet
- From: Richard Rehl <email@hidden>
- Date: Thu, 8 Mar 2007 13:11:10 -0500
Hi Jerry,
If I copy the example.html file that XCode created as part of the
project into the Build/BodyMassAWTApplet.build/Debug/
BodyMassAWTApplet.build/JavaClasses folder where
BodyMassAWTApplet.class is located and run appletviewer from the
Terminal after cding to that folder, the image displays correctly.
It's when I run from within XCode using Build and Go that the image
doesn't display.
I'm not sure I understand what you mean when you say to "print out
getDocumentBase()".
On Mar 8, 2007, at 12:41 PM, Jerry wrote:
On 8 Mar 2007, at 16:41, Richard Rehl wrote:
I'm trying to both learn Java and XCode at the same time, so bear
with me.....
I've created a Java AWT Applet project and am attempting to
display an image in the applet. I've declared the variable:
Image logo;
and in the init() method have assigned an image to the variable:
logo = getImage(getDocumentBase(), "ski.jpg");
and in the paint() method have instructed the applet to display
the image:
g.drawImage(logo,125,160,this);
and finally, I've added the image to the project from within XCode
by using Project > Add to Project, choosing the image ski.jpg and
checking the box to "Copy items into destination group's folder
(if needed)", and have verified that the image has been added to
the root of the Project folder.
The code compiles and displays in the Applet Viewer, but the image
doesn't display.
Any ideas? Here's the complete code:
I would print out getDocumentBase() and see if it's what you're
expecting. Also, try running appletviewer from Terminal in the
folder with the HTML file and see what happens.
Jerry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40comcast.net
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden