日期:2014-05-20 浏览次数:20791 次
Map<String,ImageIcon> imageMap = new HashMap<String, ImageIcon>(); int imageCount= 54; for (int i = 1; i <= imageCount; i++) { ImageIcon icon = new ImageIcon("image/card/" + i + ".png"); String image = "image" + i; imageMap.put(image,icon); } //使用icon String imageKey = "image5"; ImageIcon icon = imageMap.get(imageKey); ...