18 lines
454 B
Java
18 lines
454 B
Java
package se.urmo.my2dgame;
|
|
|
|
import javax.imageio.ImageIO;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.IOException;
|
|
import java.util.Objects;
|
|
|
|
public class ImageUtil {
|
|
public static BufferedImage loadImage(String name) {
|
|
try {
|
|
return ImageIO.read(Objects.requireNonNull(ImageUtil.class.getResourceAsStream(name)));
|
|
}catch (IOException e) {
|
|
e.printStackTrace();
|
|
return null;
|
|
}
|
|
}
|
|
}
|