📄 effedemo_1.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class EffeDemo_1 extends MIDlet implements CommandListener {
private Command exitCommand;
private TextBox tb;
public EffeDemo_1() {
exitCommand = new Command("Exit", Command.EXIT, 1);
tb = new TextBox("Demo", "", 150, 0);
tb.addCommand(exitCommand);
tb.setCommandListener(this);
}
protected void startApp() {
long startTime_1 = System.currentTimeMillis();
for(int i= 1000000;i>=0;i--){}
long timeTaken_1 = System.currentTimeMillis() - startTime_1;
long startTime_2 = System.currentTimeMillis();
for(int j= 0;j<=1000000;j++){}
long timeTaken_2 = System.currentTimeMillis() - startTime_2;
tb.setString("timeTaken_1:" + String.valueOf(timeTaken_1)
+"\ntimeTaken_2:" + String.valueOf(timeTaken_2));
Display.getDisplay(this).setCurrent(tb);
}
protected void pauseApp() {
}
protected void destroyApp(boolean arg0) {
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -