📄 uicanvas.java
字号:
package LLK;
//import javax.microedition.midlet.Canvas;
//import java.io.*;
import javax.microedition.lcdui.*;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
class UICanvas extends Canvas implements Runnable {
private MainMIDP m_midlet;
private Image m_ImgLoad;
private int m_timeMcount;
private int m_ImgNum;
public UICanvas(MainMIDP midlet) {
m_timeMcount = 0;
m_ImgNum = 0;
this.m_midlet = midlet;
m_ImgLoad = null;
//LoadGameStartImage();
}
public void LoadGameStartImage(int imgIndex) {
String strF;
//m_ImgLoad = new Image[9];
//for(int lgNumber = 1; lgNumber <= 8; lgNumber ++)
//{
if (imgIndex != 9)
strF = "/Res/Icons/Lg_" + imgIndex + ".png";
else
strF = "/Res/Icons/Loading.png";
try {
if (m_ImgLoad != null)
m_ImgLoad = null;
m_ImgLoad = Image.createImage(strF);
} catch (java.io.IOException e) {
System.out.println(" ArrayIndexOutOfBoundsException : "
+ e.getMessage());
return;
}
//}
/*
strF = "/Res/Icons/Loading.png";
try {
m_ImgLoad[8] = Image.createImage(strF);
} catch (java.io.IOException e) {
System.out.println(" ArrayIndexOutOfBoundsException : "
+ e.getMessage());
return;
}
*/
//System.out.println("ReadFileUI sucess ...");
}
protected void paint(Graphics g) {
if (m_timeMcount >= 16)
{
g.setColor(255, 255, 255);
g.fillRect(0, 0, 128, 128);
} else
{
g.setColor(0, 223, 255);
g.fillRect(0, 0, 128, 128);
}
//System.out.println("ImgNum: " + m_ImgNum);
try {
LoadGameStartImage(m_ImgNum);
g.drawImage(m_ImgLoad, 10, 40, Graphics.LEFT | Graphics.TOP);
if (m_timeMcount >= 16)
{
g.setColor(0, 0, 255);
g.drawString("Loading ...", 80, 120, 33);
} else
{
g.setColor(0, 0, 255);
g.drawString("www.mopo.cn", 60, 120, 33);
}
} catch (IllegalArgumentException ei) {
System.err.println("catch(IllegalArgumentException ei)");
} catch (NullPointerException en) {
System.err.println("catch(NullPointerException en");
}
}
public void run() {
for (;;) {
m_timeMcount++;
//System.out.println("uiCanvas run : " + m_timeMcount);
if (m_timeMcount <= 8)
{
m_ImgNum = m_timeMcount;
//LoadGameStartImage(m_timeMcount);
repaint();
//m_ImgLoad = null;
//m_midlet.ShowMainCommand();
// continue;
}
if (m_timeMcount == 16)
{
m_ImgNum = 9;
//LoadGameStartImage(9);
repaint();
m_midlet.CreateForms();
// continue;
}
if (m_timeMcount == 26)
{
m_ImgLoad = null;
m_midlet.ShowMainCommand();
return;
}
//System.out.println("timeCount: " + m_timeMcount);
try {
Thread.sleep(2);
} catch (InterruptedException er) {
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -