📄 welcomecanvas.java
字号:
import javax.microedition.lcdui.*;
import com.nokia.mid.ui.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class WelcomeCanvas
extends FullCanvas
implements Runnable {
Image image;
Display display;
Thread thread;
private int width, height;
int index;
public WelcomeCanvas(Display display, int index) {
System.out.println(1);
this.display = display;
this.index = index;
width = this.getWidth();
height = this.getHeight();
System.out.println(2);
//导入资源
try {
System.out.println(3);
if (index == 0) {
image = Image.createImage("/res/pic001.png");
}
else if (index == 1) {
image = Image.createImage("/res/pic002.png");
}
System.out.println(4);
}
catch (Exception e) {
System.out.println("aaaa"+e);
}
System.out.println(5);
thread = new Thread(this);
thread.start();
System.out.println(6);
}
//重载paint函数
protected void paint(Graphics g) {
g.setColor(0xffffff);
g.fillRect(0, 0, width, height);
g.setColor(0, 0, 0);
//画菜单背景
System.out.println(7);
if(image != null){
g.drawImage(image, 0, 0, Graphics.LEFT | Graphics.TOP);
}else{
System.out.println(9);
}
System.out.println(8);
}
//线程处理
public void run() {
try {
Thread.sleep(2000);
}
catch (Exception e) {}
//
//thread = null;
System.gc();
if (index == 0) {
WelcomeCanvas w = new WelcomeCanvas(display, 1);
if(display == null){
System.out.println(2222);
}else{
display.setCurrent(w);
}
image = null;
}
else if (index == 1) {
display.setCurrent(new MenuListCanvas(display));
image = null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -