📄 imageblock.java
字号:
package com.ismyway.fairyui;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import com.ismyway.anyview.others.Settings;
import com.ismyway.util.Theme;
public class ImageBlock extends DisplayableBlock {
Image image = null;
public ImageBlock() {
}
public boolean keyReleased(int key) {
generateEvent();
return true;
}
public void paint(Graphics g, int adjustx, int adjusty) {
if (null == image) {
return;
}
int x, y;
x = getLeft() - adjustx;
y = getTop() - adjusty;
//g.setClip(x, y, getWidth(), getHeight());
g.drawImage(image, x, y, LEFTTOP);
if (isSelected()) {
g.setColor(Theme.linkColor);
g.fillRect(x, y, getWidth(), getHeight());
}
//restoreClip(g);
}
public void putInSequence(int[] rect, int width) {
if (null == image) {
return;
}
int imgHeight = image.getHeight();
int imgWidth = image.getWidth();
imgWidth = imgWidth > width ? width : imgWidth;
setWidth(imgWidth);
setHeight(imgHeight);
setInnerLeft(rect[0]);
setInnerTop(rect[1]);
int r0 = rect[0];
int r1 = rect[1];
int r3 = rect[3];
if (rect[2] < imgWidth) { //当前行不足以显示输入框
setInnerTop(rect[1] + rect[3] + Settings.HORPADDING);
setInnerLeft(Settings.VECPADDING);
rect[0] = Settings.VECPADDING + imgWidth;
rect[1] = r1 + r3;
rect[2] = width - imgWidth;
rect[3] = imgHeight;
} else {
rect[0] = r0 + imgWidth + Settings.VECPADDING;
rect[1] = r1;
rect[2] = width - imgWidth - r0;
rect[3] = imgHeight;
}
}
public Image getImage() {
return image;
}
public void setImage(Image image) {
this.image = image;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -