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

📄 formgaugedemo.java~2~

📁 里面的工程文件是本人做的一些小程序
💻 JAVA~2~
字号:
package formgaugedemo;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import java.util.Random;
public class FormGaugeDemo extends MIDlet
implements Runnable,ItemStateListener,CommandListener{
  private boolean appFinishLoading = false;
  private int maxValue =10;
  private int alpha =1;
  private Alert splashAlert;//充当启动屏幕的alert
  private Gauge splashGauge;//显示启动进度的非交互gauge
  private Gauge NonInteractiveGauge;//有确定值的非交互gauge
  private Gauge NonIndefiniteGauge;//无确定值的非交互gauge
  private Gauge ActiveGauge;//交互式gauge
  private Random rand;//随机函数,用以模拟随机的状态
  private String[] GaugeState={"已停止","更新停止","运行中","更新中"};
  private Form mainForm;
  Command exitCmd;
  Thread sysThread;


  public FormGaugeDemo() {
    //处理启动屏幕
    splashAlert = new Alert(null);
    splashGauge = new Gauge(null,false,10,0);
    splashAlert.setType(AlertType.INFO);
    splashAlert.setTimeout(Alert.FOREVER);
    splashAlert.setString("正在加载数据,请稍后……");
    splashAlert.setIndicator(splashGauge);
    //构造相关对象
    ActiveGauge = new Gauge("交互式gauge",true,100,0);
    NonInteractiveGauge = new Gauge("有确定值的非交互gauge",false,10,0);
    NonIndefiniteGauge = new Gauge("无确定值的非交互gauge",
                                   false,Gauge.INDEFINITE,0);
    //设置布局格式
    ActiveGauge.setLayout(Item.LAYOUT_EXPAND);//根据屏幕自动扩展宽度
    NonInteractiveGauge.setLayout(Item.LAYOUT_EXPAND);//根据屏幕自动扩展宽度
    NonIndefiniteGauge.setLayout(Item.LAYOUT_EXPAND);//根据屏幕自动扩展宽度
    //在form中添加对象
    mainForm.append(ActiveGauge);
    mainForm.append(NonInteractiveGauge);
    mainForm.append(NonIndefiniteGauge);
    mainForm.addCommand(exitCmd);
    //为form设置事件监听
    mainForm.setItemStateListener(this);
    mainForm.setCommandListener(this);
    sysThread = new Thread(this);
  }
  public void startApp(){
    Display.getDisplay(this).setCurrent(splashAlert);
    sysThread.start();
  }
  public void pauseApp(){}
  public void destroyApp(boolean unconditional){}
  //线程执行的任务
  public void run(){}
  //form内item组件的状态事件处理
  public void itemStateChanged(Item item){}
  //command事件处理
  public void commandAction(Command c,Displayable d){}
  public void quitApp(){
    this.destroyApp(true);
    this.notifyDestroyed();
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -