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

📄 progressobserverui.java

📁 一个简单的移动银行实例程序
💻 JAVA
字号:
package com.chapter16.bankbillClent;import javax.microedition.lcdui.*;public class ProgressObserverUI extends Form implements ProgressObserver,         CommandListener {      private static final int GAUGE_MAX = 8;    private static final int GAUGE_LEVELS = 4;    int current = 0;    Gauge gauge;    Command stopCommand;    boolean stoppable;    boolean stopped;    public ProgressObserverUI() {        super("");        gauge = new Gauge("", false, GAUGE_MAX, 0);        stopCommand = new Command("ֹͣ",                                   Command.STOP, 10);        append(gauge);        setCommandListener(this);    }    public void init(String note, boolean stoppable) {        gauge.setValue(0);        setNote(note);        setStoppable(stoppable);        stopped = false;    }     public void setNote(String note) {        setTitle(note);    }     public boolean isStoppable() {        return stoppable;    }     public void setStoppable(boolean stoppable) {        this.stoppable = stoppable;        if (stoppable) {            addCommand(stopCommand);        } else {            removeCommand(stopCommand);        }     }      public boolean isStopped() {        return stopped;    }     public void updateProgress() {        current = (current + 1) % GAUGE_LEVELS;        gauge.setValue(current * GAUGE_MAX / GAUGE_LEVELS);    }     public void commandAction(Command c, Displayable d) {        if (c == stopCommand) {            stopped = true;        }     } }

⌨️ 快捷键说明

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