📄 autoupdategauge.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 + -