📄 five.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class five extends MIDlet
implements CommandListener
{
public static Display display;
private EfeiCanvas ec = new EfeiCanvas();
private Form form = new Form("Efei Five");
public static List list = new List("Efei Five",Choice.IMPLICIT);
public five()
{
int[] value = new int[5];
String tmp = "";
try{
tmp = getAppProperty("lineNumber"); //几乘几
if(tmp.equals(""))
{
value[0] = 11;
}
else
{
value[0] = Integer.parseInt(tmp);
}
tmp = getAppProperty("gridLength"); //格子边长
if(tmp.equals(""))
{
value[1] = 10;
value[2] = 10;
}
else
{
value[1] = Integer.parseInt(tmp);
value[2] = Integer.parseInt(tmp);
}
tmp = getAppProperty("baseX"); //左上角X
if(tmp.equals(""))
value[3] = 10;
else
value[3] = Integer.parseInt(tmp);
tmp = getAppProperty("baseY"); //左上角Y
if(tmp.equals(""))
value[4] = 10;
else
value[4] = Integer.parseInt(tmp);
}
catch(Exception e)
{
value[0] = 15;
value[1] = 10;
value[2] = 10;
value[3] = 10;
value[4] = 10;
}
ec.setParam(value); //初始化数组
display = Display.getDisplay(this);
/**
* You can use deleteAll() in MIDP 2.0
* list.deleteAll();
*/
list.append("开始游戏",null);
list.append("关于",null);
list.append("退出",null);
list.addCommand(new Command("确定",Command.OK,1));
list.setCommandListener(this);
display.setCurrent(list);
}
public void commandAction(Command c,Displayable s)
{
List tmp = (List) s;
switch(tmp.getSelectedIndex())
{
case 0:
display.setCurrent(ec);
break;
case 1:
//关于
Alert a1 = new Alert("Efei Five");
a1.setType(AlertType.INFO);
a1.setTimeout(3000);
a1.setString("Efie:很好的五子棋程序,值得一玩");
display.setCurrent(a1);
break;
case 2:
//退出
destroyApp(false);
notifyDestroyed();
break;
}
}
public static void flow(int value)
{
Displayable tmp;
switch(value)
{
case 1:
display.setCurrent(list);
break;
}
}
public void startApp()
{
if(display.getCurrent()==null){
display.setCurrent(ec);
}else
{
display.setCurrent(display.getCurrent());
}
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
try{
for(int i=list.size();i>0;i--)
list.delete(i-1);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -