📄 listitem.java.svn-base
字号:
package org.gggeye.easymf.ui;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Image;
/**
* 对于div li 标签。 <br/>
*
* 其实说白了就是相对于List列表来的
* @author wuhua
* <a href="http://wuhua.3geye.net">我的博客</a>
*
*/
public class ListItem extends View{
Image icon;
public ListItem(Image _icon, String _name){
this.icon = _icon;
this.name = _name;
this.width = Panel.viewWidth;
int tHeight = _icon !=null?_icon.getHeight():20;
this.height = tHeight > Panel.defaultFont.getHeight()?tHeight:Panel.defaultFont.getHeight();
this.height += 4;
this.hasFocus = true;
}
public void doPaint(Pen _point, HtmlDocument document) {
_point.save();
Font font = _point.getFont();
int iconWidth = icon != null ? icon.getWidth() + 4 : 0;
int iconHeight = icon != null ? icon.getHeight() : 0;
int y = top + ((this.height - font.getHeight()) >> 1);
int x = left + 4;
int y1 = y + ((font.getHeight() - iconHeight) >> 1);
if ( index == document.focusIndex) {
x = left;
_point.setColor(0x00dd00);
_point.fillRect(left, top, width, height);
_point.setColor(0xFFFFFF);
x -= 2;
}
if (icon != null) {
_point.drawImage(icon, x, y1, 20);
_point.drawString(name, x + iconWidth, y, 20);
}
else{
_point.drawString(name, x , y, 20);
}
_point.reset();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -