whatisitform.java
来自「这个是perst-269.zip下面的SOURCECODE,和大家分享了。」· Java 代码 · 共 38 行
JAVA
38 行
import javax.microedition.lcdui.*;
public class WhatIsItForm extends Form implements CommandListener {
Guess midlet;
TextField animal;
TextField difference;
TreeNode parent;
NewNodeCallback action;
static final int YES = 0;
static final int NO = 1;
WhatIsItForm(Guess midlet, TreeNode parent, NewNodeCallback action) {
super("New animal");
this.midlet = midlet;
this.action = action;
this.parent = parent;
animal = new TextField("What is it", "", 32, TextField.ANY);
difference = new TextField("What is a difference from others", "", 32, TextField.ANY);
append(animal);
append(difference);
addCommand(Guess.QUIT_CMD);
addCommand(Guess.DONE_CMD);
setCommandListener(this);
Display.getDisplay(midlet).setCurrent(this);
}
public void commandAction(Command c, Displayable d)
{
if (c == Guess.QUIT_CMD) {
midlet.quit();
} else if (c == Guess.DONE_CMD) {
action.callback(new TreeNode(parent, difference.getString(), new TreeNode(null, animal.getString(), null)));
Display.getDisplay(midlet).setCurrent(midlet.areYouReady);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?