import javax.microedition.lcdui.*;
public class SchoolView extends Canvas implements Runnable {
// 循环显示用的图片数组
private Image img[] = new Image[6];
private int i = 0;
// 判断循环是否仍在运行
private boolean isPlay;
public SchoolView(Display display) {
try {
img[0] = Image.createImage("/quanjing_1.png");
img[1] = Image.createImage("/tushuguan1.png");
img[2] = Image.createImage("/yundonghui1.png");
img[3] = Image.createImage("/shitou1.png");
img[4] = Image.createImage("/t21.png");
img[5] = Image.createImage("/t112.png");
} catch (Exception e) {
System.out.println("导入图片错误");
}
}
public void start() {
isPlay = true;
Thread t = new Thread(this);//创建线程
t.start();//启动线程
}
public void stop() {
isPlay = false;
}
public void run() {
while (isPlay) {
if (i > 5) {
i = 0;
repaint();
}
i++;
try {
Thread.sleep(1500);//睡眠时间1500毫秒
} catch (Exception e) {
}
repaint(); !--判断阅读权限-->!--判断是否已经扣点--> |