public class Img { private static final Toolkit tk = Toolkit.getDefaultToolkit(); public static final Image getTankImageIsFriendly(Direction dir, boolean b) { int j = getTankImage(dir); String str = "image/Tank/green/Tank" + j + ".png"; if (b) { str = "image/Tank/pink/Tank" + j + ".png"; } Image img = tk.getImage(Img.class.getClassLoader().getResource(str)); // Image img = new ImageIcon(str).getImage(); return img; } }
时间: 2024-11-05 13:37:56