?? btfirmidlet.java
字號:
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class BTFIRMIDlet extends MIDlet implements CommandListener
{
private Display display;
private Form form;
private Image imgSplash;
private Command CMD_EXIT;
private Command CMD_PLAY;
private Alert alert;
private BTFIRCanvas myCanvas;
private boolean isServer;
private ChoiceGroup choiceType;
public BTFIRMIDlet()
{
alert = new Alert("程序信息");
alert.setTimeout(3000);
try
{
imgSplash = Image.createImage("/splash.png");
alert.setImage(imgSplash);
}
catch (IOException _ex)
{
imgSplash = Image.createImage(1, 1);
}
form = new Form("");
StringItem item = new StringItem("說明:", "本五子棋游戲支持藍牙雙人對戰");
form.append(item);
choiceType = new ChoiceGroup("請選擇連接類型:", 1);
choiceType.append("服務器", null);
choiceType.append("客戶端", null);
form.append(choiceType);
CMD_PLAY = new Command("開始", 4, 2);
CMD_EXIT = new Command("退出", 3, 1);
form.addCommand(CMD_PLAY);
form.addCommand(CMD_EXIT);
form.setCommandListener(this);
}
public void startApp()
{
Display.getDisplay(this).setCurrent(alert, form);
}
public void pauseApp(){}
public void destroyApp(boolean arg0){}
public void commandAction(Command c, Displayable s)
{
if (c == CMD_EXIT)
{
exit();
}
else
if (c == CMD_PLAY)
{
isServer = choiceType.getSelectedIndex() == 0 ? true : false;
myCanvas = new BTFIRCanvas(this, isServer);
Display.getDisplay(this).setCurrent(myCanvas);
myCanvas.openConnection();
myCanvas.newStage();
}
}
public void exit()
{
destroyApp(false);
notifyDestroyed();
}
Displayable getDisplayable()
{
return form;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -