?? radio.java.svn-base
字號:
package org.gggeye.easymf.ui;
import javax.microedition.lcdui.Image;
import org.gggeye.easymf.util.Tools;
/**
* 單選框
* @author wuhua
* <a href="http://wuhua.3geye.net">我的博客</a>
*
*/
public class Radio extends View {
static Image checked = Tools.readImage("/r4.png");
static Image unChecked = Tools.readImage("/r3.png");
boolean isCheck = false;
Radio(String _name, String _id, String _value, boolean _isCheck){
this.name = _name;
this.id = _id;
this.value = _name;
this.isCheck = _isCheck;
this.hasFocus = true;
}
/**
* 事件處理,記住同名稱的應(yīng)該相互排斥
*/
void doClick(int _keyCode) {
// 如果當前是做選擇,排除其他所有的Radio選項
if(_keyCode == 8){
this.isCheck = !this.isCheck;
for(int i=0; i<htmlDocument.size(); i++){
View tView = this.htmlDocument.getView(i);
if(tView instanceof Radio){
Radio tRadio = (Radio)tView;
if(tRadio != this &&
tRadio.name.equals(name)
&& tRadio.id.equals(id))
tRadio.isCheck = false;
}
}
}
}
public void doPaint(Pen _pen, HtmlDocument _document) {
_pen.save();
if(this.index == _document.focusIndex){
_pen.drawRects(left-1, top, width-1, height-2);
}
_pen.drawImage(isCheck?checked:unChecked, left, top, 20);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -