本帖最后由 会断 于 2021-5-25 08:26 编辑
pause输出为4是什么原因?gif的输出为2是因为代码不对吗,我可能还没学到
[Java] 纯文本查看 复制代码 package cn.tedu;
import javax.swing.ImageIcon;
public class Images {
public static final ImageIcon[] airplane;
public static final ImageIcon[] bigairplane;
public static final ImageIcon bee;
public static final ImageIcon bullet;
public static final ImageIcon[] hero;
public static final ImageIcon bom;
public static final ImageIcon sky;
public static final ImageIcon start;
public static final ImageIcon pause;
public static final ImageIcon gameover;
static {
airplane = new ImageIcon[2];
airplane[0] = new ImageIcon("images/airplane0.png");
airplane[1] = new ImageIcon("images/airplane1.png");
bigairplane = new ImageIcon[2];
bigairplane[0] = new ImageIcon("images/bigairplane0.png");
bigairplane[1] = new ImageIcon("images/bigairplane1.png");
bee = new ImageIcon("images/bee0.gif");
bullet = new ImageIcon("images/bullet.png");
hero = new ImageIcon[2];
hero[0] = new ImageIcon("images/hero0.png");
hero[1] = new ImageIcon("images/hero1.png");
bom = new ImageIcon("images/bom.gif");
sky = new ImageIcon("images/background.png");
start = new ImageIcon("images/start.png");
pause = new ImageIcon("iamges/pause.png");
gameover = new ImageIcon("images/gameover.png");
}
public static void main(String[] args) {
System.out.println(airplane[0].getImageLoadStatus());
System.out.println(airplane[1].getImageLoadStatus());
System.out.println(bigairplane[0].getImageLoadStatus());
System.out.println(bigairplane[1].getImageLoadStatus());
System.out.println(bee.getImageLoadStatus());
System.out.println(bullet.getImageLoadStatus());
System.out.println(hero[0].getImageLoadStatus());
System.out.println(hero[1].getImageLoadStatus());
System.out.println(bom.getImageLoadStatus());
System.out.println(sky.getImageLoadStatus());
System.out.println(start.getImageLoadStatus());
System.out.println(pause.getImageLoadStatus());
System.out.println(gameover.getImageLoadStatus());
}
}
|