autoupdategauge.java
来自「j2me無線學習源碼,一個無線連接的源碼,很有用的哦」· Java 代码 · 共 35 行
JAVA
35 行
//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 + =
减小字号Ctrl + -
显示快捷键?