1 The method getImage(URL) is undefined for the type Image12 The method drawImage(Image, int, int, ImageObserver) in the type Graphics is not applicable for the arguments (Image, int, int, Image1)2 The method paint(Graphics) in the type Image1 is not applicable for the arguments ()
呵呵,javainthink好快啊,搂主不需要再翻译成中文了把-------------------------------
晕。我就是楼主。^_^~
1。getImage(URL)方法没有定义
2。drawImage(Image, int, int, ImageObserver)这个方法应该传这样的参数,而你的第四个参数this和方法里面的参数类型不对应
3。你的类里面的paint(Graphics)是这样定义的,而你调用的是没有参数的paint()方法
第一个是getImage(URL)方法没有定义
第二个是调用Graphics对象的drawImage方法时提供的参数不正确
第三个是调用Image1对象的paint方法参数不正确这样解释可以吗
import java.net.*;
import java.awt.*; public class imag extends Applet{
Image image;
public void init() {
String url = "http://www.google.com/images/logo_sm.gif";
try {
image = getImage(new URL(url));
} catch(Exception e){}
} public void paint(Graphics g) {
g.drawImage(image, 0, 0,this);
}
} 我不知道怎样修改成Application才能测试成功。
你们能帮我改一个吗?看来我基础实在是太差了。^_^!
而且getImage()方法不是在文档里本身有的吗?难道还要定义?