当前位置: 技术问答>java相关
一个Applet小问题
来源: 互联网 发布时间:2015-10-25
本文导语: import java.awt.*; 6.import java.applet.Applet; public class HwImage extends Applet { Image duke; public void init() { duke = getImage(getDocumentBase(), "graphics/SurferDuke.gif"); } public void paint...
import java.awt.*;
6.import java.applet.Applet;
public class HwImage extends Applet {
Image duke;
public void init() {
duke = getImage(getDocumentBase(),
"graphics/SurferDuke.gif");
}
public void paint(Graphics g) {
g.drawImage(duke, 25, 25, this);
}
}
请问graphics/SurferDuke.gif的实际地址是哪里?
6.import java.applet.Applet;
public class HwImage extends Applet {
Image duke;
public void init() {
duke = getImage(getDocumentBase(),
"graphics/SurferDuke.gif");
}
public void paint(Graphics g) {
g.drawImage(duke, 25, 25, this);
}
}
请问graphics/SurferDuke.gif的实际地址是哪里?
|
你的document的絕對路徑,一般你就可以放在source文件相對應的目錄下
|
就是说如果你的原文件在c:java目录下
gif就应该是c:javagraphicsSurferDuke.gif
ok?
gif就应该是c:javagraphicsSurferDuke.gif
ok?