日期:2014-05-20 浏览次数:20962 次
public class Plane {
int x; //飞机的位置
int y;
String path;
Image planeImage;
public Plane(int x, int y) {
this.x = x;
this.y = y;
path = URLDecoder.decode(getClass().getResource("../images/test.gif").getPath());
ImageIcon icon = new ImageIcon(path);
planeImage = icon.getImage();
}
public void draw(Graphics g) {
g.drawImage(planeImage, x, y, null);
}
}
BufferedImage planeImage = ImageIO.read(getClass().getResource("../images/test.gif"));