@ -0,0 +1,7 @@
|
|||||||
|
package com.example.tankbattle;
|
||||||
|
|
||||||
|
public class Image {
|
||||||
|
public void test() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.example.tankbattle;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ResourceMgr {
|
||||||
|
public static BufferedImage tankL, tankU, tankR, tankD;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
tankL = ImageIO.read(ResourceMgr.class.getClassLoader().getResourceAsStream("images/tankL.gif"));
|
||||||
|
tankU = ImageIO.read(ResourceMgr.class.getClassLoader().getResourceAsStream("images/tankU.gif"));
|
||||||
|
tankR = ImageIO.read(ResourceMgr.class.getClassLoader().getResourceAsStream("images/tankR.gif"));
|
||||||
|
tankD = ImageIO.read(ResourceMgr.class.getClassLoader().getResourceAsStream("images/tankD.gif"));
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceMgr() {
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 824 B |
After Width: | Height: | Size: 868 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 936 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 855 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 852 B |
After Width: | Height: | Size: 312 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1022 B |
After Width: | Height: | Size: 814 B |
After Width: | Height: | Size: 460 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 864 B |
After Width: | Height: | Size: 863 B |
After Width: | Height: | Size: 861 B |
After Width: | Height: | Size: 863 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 670 B |
After Width: | Height: | Size: 680 B |
After Width: | Height: | Size: 677 B |
After Width: | Height: | Size: 660 B |
After Width: | Height: | Size: 691 B |
After Width: | Height: | Size: 674 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,29 @@
|
|||||||
|
package com.example.tankbattle;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
public class ImageTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test(){
|
||||||
|
System.out.println(ImageTest.class.getClassLoader());
|
||||||
|
try {
|
||||||
|
BufferedImage image = ImageIO.read(new File("C:/work/javaprojects/Tank_60/src/images/bulletD.gif"));
|
||||||
|
assertNotNull(image);
|
||||||
|
BufferedImage image2 = ImageIO.read(ImageTest.class.getClassLoader().getResourceAsStream("src/images" +
|
||||||
|
"/bulletD.gif"));
|
||||||
|
assertNotNull(image2);
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|