IncrementalIndefiniteGaugeRunnable.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.lcdui.*;
- public class IncrementalIndefiniteGaugeRunnable extends Gauge
- implements Runnable {
- private boolean done = false;
- /**
- * The constructor initializes the gauge.
- */
- public IncrementalIndefiniteGaugeRunnable(String label) {
- super(label, false, Gauge.INDEFINITE, Gauge.INCREMENTAL_IDLE);
- new Thread(this).start();
- }
- /**
- * This method moves the gauge left and right.
- */
- public void run() {
- while (!done) {
- setValue(Gauge.INCREMENTAL_UPDATING);
- try {
- Thread.currentThread().sleep(1000);
- } catch (InterruptedException err) {
- }
- }
- }
- void setDone() {
- done = true;
- }
- }