netform2.java

来自「j2me的坦克大战 元代码 单机版和蓝牙联网版」· Java 代码 · 共 38 行

JAVA
38
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */import javax.microedition.midlet.*;import javax.microedition.lcdui.*; public class NetForm2 extends Form implements CommandListener {    private GameMidlet gameMidlet;    private ChoiceGroup group;    private Command cmd_OK;    private Command cmd_BACK;    public NetForm2(GameMidlet gameMidlet) {        super("Online 1vs1");        this.gameMidlet = gameMidlet;        group = new ChoiceGroup("Choose",Choice.EXCLUSIVE);        cmd_OK = new Command("OK",Command.OK,1);        cmd_BACK = new Command("Back",Command.BACK,1);        group.append("Server", null);        group.append("Client", null);        append(group);        addCommand(cmd_OK);        addCommand(cmd_BACK);        setCommandListener(this);    }    public void commandAction(Command c, Displayable arg1) {        if(c == cmd_OK) {            boolean isServer = group.getSelectedIndex() == 0? true : false;            gameMidlet.newNetGame2(isServer);        }        if(c == cmd_BACK) {            gameMidlet.gameMenuCanvasBack();        }            }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?