📄 logo.java
字号:
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
public class Logo extends Canvas implements Runnable
{
private Image a;
private Image b;
private Image c;
private int W;
private int H;
private int showtime;
private int cont;
private Thread th;
private boolean start;
private Tank ta; //main class instance
public Logo(Tank tan)
{
ta = tan;
W = 128;//getWidth()
H = 128;//getHeight()
start = true;
setFullScreenMode(true);
a = loadimg("/logo1.png");
b = loadimg("/logo2.png");
c = loadimg("/logo3.png");
th = new Thread(this);
th.start();
}
public Image loadimg(String imgname)
{
Image img=null;
try
{
if(img == null)
{
img = Image.createImage(imgname);
}
}catch(Exception ee)
{
ee.printStackTrace();
}
return img;
}
public void run()
{
while(start)
{
try
{
showtime++;
repaint();
serviceRepaints();
Thread.sleep(1000);
}catch(Exception e)
{
e.printStackTrace();
}
}
}
public void paint(Graphics g)
{
g.setColor(0xffffff);
g.fillRect(0,0,W,H);
switch(cont)
{
case 0:
g.drawImage(a,(128-a.getWidth())/2,(128-a.getHeight())/2,g.TOP|g.LEFT);
if(showtime<30)
cont++;
break;
case 1:
g.drawImage(b,(128-b.getWidth())/2,(128-b.getHeight())/2,g.TOP|g.LEFT);
if(showtime<50)
cont++;
break;
case 2:
g.drawImage(c,(128-c.getWidth())/2,(128-c.getHeight())/2,g.TOP|g.LEFT);
if(showtime<70)
cont=5;
break;
default:
a = b = c = null;
start = false;
th = null;
//System.out.println("logo load end!!!!");
ta.Tk = new TkC(ta);
Display.getDisplay(ta).setCurrent(ta.Tk);
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -