The Artima Developer Community
Sponsored Link

Java Answers Forum
help with adding image to applet

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
thomas

Posts: 42
Nickname: turbomanic
Registered: Jul, 2002

help with adding image to applet Posted: Aug 8, 2002 7:44 AM
Reply to this message Reply
Advertisement
this is my code:
import java.awt.*;
import java.applet.Applet;

/*
* This applet displays a single image twice,
* once at its normal size and once much wider.
*/

public class ImageDisplay extends Applet {
Image image;

public void init() {
image = getImage(getCodeBase(), "rocketguy.gif");
}

public void paint(Graphics g) {
//Draw image at its natural size first.
g.drawImage(image, 0, 0, this); //85x62 image

//Now draw the image scaled.
g.drawImage(image, 90, 0, 300, 62, this);
}
}
error comes up saying incompatable type
required Image
get java.awt.Image

I got both programme and picture file in the same folder but not uploaded on net. can anyone tell me what is wrong?

Topic: spread of computer viruses - a java simulation Previous Topic   Next Topic Topic: Nested for loops

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use