📄 imagefactory.java
字号:
import javax.swing.ImageIcon;
import java.net.URLClassLoader;
public class ImageFactory {
private static ImageFactory imagefactory;
private static ImageIcon images[];
private ImageFactory(){
images = new ImageIcon[18];
URLClassLoader loader = (URLClassLoader)getClass().getClassLoader();
for(int i=0;i<7;i++)
{
images[i] = new ImageIcon(getClass().getResource("Image/"+i+i+".JPG"));
}
images[7] = new ImageIcon(getClass().getResource("Image/start.gif"));
images[8] = new ImageIcon(getClass().getResource("Image/stop.gif"));
images[9] = new ImageIcon(getClass().getResource("Image/auto.gif"));
images[10] = new ImageIcon(getClass().getResource("Image/pool.jpg"));
images[11]=new ImageIcon(getClass().getResource("Image/kong.JPG"));
images[12]=new ImageIcon(getClass().getResource("Image/mouse.cur"));
images[13] = new ImageIcon(getClass().getResource("Image/zhuanshi.JPG"));
images[14] = new ImageIcon(getClass().getResource("Image/zhadan.JPG"));
images[15] = new ImageIcon(getClass().getResource("Image/tishi.JPG"));
images[16]=new ImageIcon(getClass().getResource("Image/hong1.JPG"));
images[17]=new ImageIcon(getClass().getResource("Image/lv1.JPG"));
}
public ImageIcon getImageicon(int i) {
return images[i];
}
public static synchronized ImageFactory getInstance() {
if(imagefactory != null) {
return imagefactory;
} else {
imagefactory = new ImageFactory();
return imagefactory;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -