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

📄 autoupdategauge.java

📁 J2ME MIDP 2.0 无线设备编程的一些源码
💻 JAVA
字号:
//AutoUpdateGauge.java file
package itemex;
import javax.microedition.lcdui.*;

public class AutoUpdateGauge extends Gauge
{//Button 类,用于表示按钮
    private int updatePeriod;
    //构造函数
    //参数label:标题,period:更新间隔
    public AutoUpdateGauge(String label, int period) 
    {
        super(label, false, INDEFINITE, INCREMENTAL_UPDATING);
        updatePeriod = period;
        //创建并启动线程,线程用于更新定期INCREMENTAL_UPDATING 状态的进度条
        new Thread()
        {
            public void run() 
            {
                while (true) 
                {
                    setValue(Gauge.INCREMENTAL_UPDATING);
                    try 
                    {
                        Thread.sleep(updatePeriod);
                    }
                    catch (InterruptedException e)
                    {
                        System.out.println("sleep error : " +e.getMessage());
                    }
                }
            }
        }.start();
    }
}
    

⌨️ 快捷键说明

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