inputform.java
来自「一个不错的学习游戏,很适合初学者! 希望大家喜欢!」· Java 代码 · 共 60 行
JAVA
60 行
package qian;import javax.microedition.lcdui.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class InputForm extends Form implements CommandListener { StringItem stringItem1; TextField textField1; GameCanvas gc; public InputForm(GameCanvas canvas) { super("积分榜"); gc = canvas; try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { stringItem1 = new StringItem("您的名字:", ""); textField1 = new TextField("", "", 15, TextField.ANY); textField1.setLabel(""); stringItem1.setText(""); stringItem1.setPreferredSize(95, 16); setCommandListener(this); addCommand(new Command("确定", Command.OK, 1)); addCommand(new Command("取消", Command.CANCEL, 2)); this.append(stringItem1); this.append(textField1); } public void commandAction(Command command, Displayable displayable) { if (command.getCommandType() == Command.CANCEL) { } else { gc.addPlayer(textField1.getString(), gc.score ); } gc.status = 1; Qianmain.instance.setScreen(gc); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?