📄 testbox.java
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class testBox extends MIDlet implements CommandListener {
private Display display;
//
private Box box;
//
public testBox() {
}
//
//private int dateTime = 15456;
// 日期
//private DateField date;
// 日期
private TextField date;
// 油量
private TextField gas;
// 每公里油耗
private TextField pergas;
// 油耗的具体取值
private String gasPoint = "";
//
private String datetime = "";//2007-9-3
//
private String gasPer = "";
private final static Command EXIT = new Command("Exit",Command.EXIT,1);
private final static Command BACK = new Command("Back",Command.BACK,1);
public void startApp() {
long datee = System.currentTimeMillis();
if(box == null){
box = new Box(this);
}
if (display == null) {
display = Display.getDisplay(this);
}
display.setCurrent(box);
Form ff = new Form("油耗测试");
date = new TextField("日期:", datetime, 20, TextField.ANY);
gas = new TextField("油耗:", gasPoint, 15, TextField.NUMERIC);
pergas = new TextField("百公里油耗:", gasPer, 15, TextField.NUMERIC);
TextField dd = new TextField ("ddd:","rrrr",18,TextField.ANY);
//System.out.println("gasPoint = " + gasPoint);
ff.append(date);
ff.append(gas);
ff.append(pergas);
ff.append(dd);
ff.addCommand(EXIT);
ff.addCommand(BACK);
ff.setTicker(new Ticker("欢迎光临!!!"));
display.setCurrent(ff);
//ff.append()
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
System.out.println("gasPoint = " + gasPoint);
notifyDestroyed();
}
public void commandAction(Command c,Displayable d){
if(c == EXIT){
destroyApp(true);
}
}
//
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -