⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientui.java

📁 支持蓝牙的手机游戏 支持蓝牙的手机游戏的分析与实现
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package org.challenge.chengshi.game.client;import java.util.Enumeration;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Displayable;import javax.microedition.lcdui.List;import org.challenge.chengshi.game.GameUI;/** * * 用于显示蓝牙服务列表 * @author challenge */public class ClientUI extends List implements CommandListener {    private GameUI gameUI; //   private GameClient gameClient=new GameClient();    private Command backCommand=new Command("后退",Command.BACK,1);//    private Command exitCommand=new Command("退出",Command.EXIT,2);    Command searchCommand=new Command("搜索",Command.SCREEN,1);//    private List serverList=new List("");        public ClientUI(GameUI gameUI){        super("蓝牙服务列表",List.IMPLICIT);        this.gameUI=gameUI;        this.addCommand(this.backCommand);//        this.addCommand(this.exitCommand);        this.addCommand(this.searchCommand);        this.setCommandListener(this);        this.init();    }        public void init(){  /*      for(int i=0;i<this.serverList.size();i++){            this.serverList.delete(0);        }*/        this.deleteAll();        this.gameUI.client.search();        Enumeration e=this.gameUI.getRemoteName();        if(e.hasMoreElements()){            this.append((String)e.nextElement(), null);            for(;e.hasMoreElements();){                this.append((String)e.nextElement(), null);            }        }else this.append("null", null);        //显示服务列表/*        Vector vector=this.gameUI.client.getRemoteName();        for(int i=0;i<vector.size();i++){            this.serverList.append((String)vector.elementAt(i), null);        }*/ //       this.gameClient.init();        this.show();    }        public void show(){        this.gameUI.mid.setDisplayable(this);    }        public void destroy(){    }    public void commandAction(Command cmd, Displayable display) {        if(cmd==this.backCommand){            this.gameUI.mid.show();        }else if(cmd==List.SELECT_COMMAND){//            this.gameUI.client.notifyAll();            if(!this.getString(this.getSelectedIndex()).equals("null")){                this.gameUI.connect(this.getString(this.getSelectedIndex()));                this.gameUI.init();            }                    }else if(cmd==this.searchCommand){            this.init();        }    }}

⌨️ 快捷键说明

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