import javax.microedition.lcdui.*;
//ゲージとティッカーを使う(フォーム)
class GaugeForm extends Form
implements CommandListener {
Gauge gauge;//ゲージ
Command soft1;//ソフトキー1
//コンストラクタ
GaugeForm(){
super("GaugeEx");
//ティッカーの設定
setTicker(new Ticker("これはティッカーのテストです。"));
//ゲージ
gauge=new Gauge("gauge",true,10,5);
append(gauge);
//ソフトキー
soft1=new Command("OK",Command.SCREEN,1);
addCommand(soft1);
setCommandListener(this);
}
//ソフトキーイベント
public void commandAction(Command c,Displayable s) {
//OK
if (c==soft1) {
//アラート
Alert alert=new Alert("情報",
"ゲージの値は"+gauge.getValue()+"です。",
null,AlertType.INFO);
alert.setTimeout(Alert.FOREVER);
(Display.getDisplay(GaugeEx.current)).setCurrent(alert);
}
}
}
|