Toolkit.getImage获取图片

Toolkit.getImage获取图片_第1张图片

 

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;
    }
}

 

你可能感兴趣的:(Toolkit.getImage获取图片)