textfieldmidlet.java
来自「j2me接口的例子,很不错的东东 可以做教程」· Java 代码 · 共 40 行
JAVA
40 行
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TextFieldMIDlet extends MIDlet implements CommandListener {
private Command exitComm;
private TextField text;
private Display display;
public TextFieldMIDlet() {
display = Display.getDisplay(this);
exitComm = new Command("离开", Command.EXIT, 1);
text = new TextField("姓名", "张三", 10, TextField.ANY);
}
public void startApp() {
Form form = new Form("TextField示范");
form.append(text);
form.addCommand(exitComm);
form.setCommandListener(this);
display.setCurrent(form);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
String comm = c.getLabel();
if (comm.equals("离开")) {
destroyApp(false);
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?