private static Toolkit tk =Toolkit.getDefaultToolkit(); //拿到默认工具包,通过工具包的方法把硬盘上的图片拿到内存中来
private static Image[] exploreImages = null;
private static Map<String,Image> map = new HashMap<String,Image>();
static{ //静态代码区, “静态块”中代码的特点是:在这个类被装载时就会执行,且只执行一次。
exploreImages = new Image[]{
tk.getImage(Explore.class.getClassLoader().getResource("images/effect_blast_1.png")),
tk.getImage(Explore.class.getClassLoader().getResource("images/effect_blast_2.png")),
tk.getImage(Explore.class.getClassLoader().getResource("images/effect_blast_3.png")),
tk.getImage(Explore.class.getClassLoader().getResource("images/effect_blast_4.png")),
tk.getImage(Explore.class.getClassLoader().getResource("images/effect_blast_5.png"))
tk.get
};
}