Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

adding Image in Java Applet

807606May 24 2007 — edited May 24 2007
hello!

I would like to add an Image in an Applet. I am creating a simple game
for my Java Programming class of my university and i would like to add
a funny GIF image when the player wins.
I added this:
Image GAMEOVER = Toolkit.getDefaultToolkit().getImage ( "gameover.gif" );
in the same place i declare my variables etc etc

and this:
g.drawImage(GAMEOVER, 0, 0, this);
in the
public void GameOver (Graphics g) { }
it contains some more code of course but nothing to do with the image.

Compiler compiles it with no errors but I can't see the applet in browser.
It only shows an X.

I removed the drawImage code ( i left only the image reader ) and i
still see only the X.

any clues guys?

thanks in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2007
Added on May 24 2007
4 comments
106 views