?? clientui.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 + -