📄 imageview.java.svn-base
字号:
package org.gggeye.easymf.ui;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Image;
/**
* 对PNG,JPEG,GIF的支持
* @author wuhua
*
*/
public class ImageView extends View {
Image image;
public ImageView(String _src, String _alt, Image _image, String _action,
HyperLink _hyperLink) {
this.image = _image;
this.action = _action;
this.name = _src;
this.value = _alt;
this.addHyperLink(_hyperLink);
}
final void resetImage(byte[] _imageBytes, Canvas _canvas) throws java.lang.Throwable {
if (_imageBytes == null)
return;
this.resetImage(Image.createImage(_imageBytes, 0,
_imageBytes.length));
}
final void resetImage(Image _image) {
if(_image == null)
return;
image = _image;
// if (_image == null) {
// this.width = 20;
// this.height = DocumentBuilder.defaultHeight;
// this.right = this.left + width;
// this.buttom = this.top + height;
//
// } else {
this.width = _image.getWidth() + ViewBuilder.LEFT_SPACE;
this.height = _image.getHeight() + ViewBuilder.TOP_SPACE;
this.right = this.left + width;
this.buttom = this.top + height;
// }
}
public void doPaint(Pen point, HtmlDocument _htmlDocument) {
if (_htmlDocument.focusIndex == this.index) {
point.drawRects(left, top, width, height);
}
doDrawImage(point);
}
protected void doDrawImage(Pen point) {
if (image == null ) {
point.drawRect(left, top, width, height);
point.drawString("图", left, top, 20);
} else
point.drawImage(image, left + (ViewBuilder.LEFT_SPACE), top
+ (ViewBuilder.TOP_SPACE), 20);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -