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

📄 gaugeobserverui.java

📁 用J2ME写的一个移动校园管理软件。我是看这个学习J2ME的。现在看来写得不是很好。
💻 JAVA
字号:
/*
 * GaugeObserverUI.java
 *
 * Created on 2006年8月21日, 上午9:47
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package cn.edu.nwpu.MobileCampusClinet;
import javax.microedition.lcdui.*;

/**
 * 
 * @author NickJava
 */
public class GaugeObserverUI extends Form implements CommandListener {
    private static final int MAX=8;
    private static final int LEVELS=8;
    int current = 0;
    Gauge gauge;
    Command stopCommand;
    boolean stop;
    boolean stopped;
    /** Creates a new instance of GaugeObserverUI */
    public GaugeObserverUI() {
        super("");
        //创建一个进度条
        gauge = new Gauge("",false,MAX,0);
        stopCommand=new Command("停止",Command.STOP,10);
        append(gauge);
        setCommandListener(this);
        
    }
    //初时化进度条
    public void init(String note , boolean stop){
        gauge.setValue(0);
        setNote(note);
        setStop(stop);
        stopped=false;
    }
    //进度条标题
    public void setNote(String note){
        setTitle(note);
    }
    //是否停止
    public boolean isStop(){
        return stop;
    }
    //设置进度条停止
    public void setStop(boolean stop){
        this.stop=stop;
        if(stop){
            addCommand(stopCommand);
        }else{
            removeCommand(stopCommand);
        }
    }
    //是否已停止
    public boolean isStopped(){
        return stopped;
    }
    //更新进度条
    public void updateGauge(){
        current = (current+1) % LEVELS;
        gauge.setValue(current * MAX / LEVELS);
    }
    //处理监听
    public void commandAction(Command c , Displayable d){
        if(c==stopCommand){
            stopped=true;
        }
    }
}

⌨️ 快捷键说明

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