📄 imagestools.java
字号:
/*
* Created on Apr 7, 2005
*
* TODO load the image to memory when this program is loaded, then program can
* use image from memory directly
*/
package mqqqvpppm.util;
import java.awt.Image;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
/**
* @author mqqqvpppm
*
* TODO load the image to memory when this program is loaded, then program can
* use image from memory directly
*/
public class ImagesTools {
/** Returns an ImageIcon, or null if the path was invalid. */
public static ImageIcon createImageIcon(java.net.URL imgURL) {
if (imgURL != null) {
return new javax.swing.ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file in: " + imgURL.getPath());
return null;
}
}
public static Image createImage(URL imgURL) {
if(imgURL == null) return null;
try {
Image ret = ImageIO.read(imgURL);
return ret;
} catch (Exception exception) {
System.err.println("Couldn't find file in: " + imgURL.getPath());
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -