📄 objcreateappletimage.java
字号:
//Vedio rental System Developed by Banu
// this code will create the image for the icon that display on the toolbar buttons
import java.awt.Toolkit;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import javax.swing.ImageIcon;
public class objCreateAppletImage
{
public static ImageIcon getImageIcon (String path, String description, int fileSize) throws Exception
{
int count = 0;
BufferedInputStream imgStream = new BufferedInputStream(new FileInputStream(path));
byte buff[] = new byte[fileSize];
if (imgStream == null) //If doesn't exist
{
throw new Exception("File not Found");
}
try
{
count = imgStream.read(buff);
imgStream.close();
}
catch (IOException ex)
{
throw new Exception("Corrupt file");
}
return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buff), description);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -