⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listitem.java

📁 开发框架。 一.说明: 此框架的意图是解决手机软件开发中常遇到
💻 JAVA
字号:
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 tH = iconHeight - font.getHeight();
		if(tH <0)
			tH = -tH;
		//int fontY = this.top + ((tW)>>1) ; //(open.getHeight())<<1;
		
		int y1 = y + ((tH)>>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 + -