📄 imageutil.java
字号:
import javax.microedition.lcdui.*;
import java.io.*;
public class ImageUtil {
public static Image getFixImage(String imageName,int width,int height) {
Image img = null;
try {
img = Image.createImage(imageName);
}
catch (IOException ex) {
ex.printStackTrace();
}
int imgWidth = img.getWidth();
int imgHeight = img.getHeight();
int actWidth = ((int)(imgWidth / width))*width;
int actHeight = ((int)(imgHeight / height))*height;
Image retImage = Image.createImage(actWidth,actHeight);
Graphics gPaint = retImage.getGraphics();
gPaint.drawImage(img,0,0,Graphics.LEFT|Graphics.TOP);
return retImage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -