MyAlert.java
上传用户:public
上传日期:2010-01-27
资源大小:484k
文件大小:1k
- package GameDisplay;
- import javax.microedition.lcdui.*;
- import java.util.*;
- public class MyAlert extends Alert {
- Image AlertImg;
- Gauge mygauge;
- MyTimerTask mytask;
- Timer tt ;
- public MyAlert() {
- super("Loading......");
- try {
- AlertImg = Image.createImage("/res/alert.jpg");
- // data = new int[AlertImg.getWidth() * AlertImg.getHeight()];
- // AlertImg.getRGB(data, 0, AlertImg.getWidth(), 0, 0, AlertImg
- // .getWidth(), AlertImg.getHeight());
- }
- catch (Exception ex) {
- }
- mygauge = new Gauge(null,false,9, 1);///注意 此用法参数!!!
- tt= new Timer();
- mytask = new MyTimerTask();
- this.setImage(AlertImg);
- this.setTimeout(3000);
- this.setIndicator(mygauge);/////////////在Alert上添加一个Gauge
- tt.scheduleAtFixedRate(mytask, 0, 300);
- }
- public void start() {
- if (mygauge.getValue() < mygauge.getMaxValue())
- mygauge.setValue(mygauge.getValue() + 1);
- else
- {
- tt.cancel();
- Control.showMenu();
- }
- }
- }