?? helloworldmidlet.java
字號:
package firstj2me;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.ConnectionNotFoundException;
public class HelloWorldMIDlet extends MIDlet implements CommandListener {
public static HelloWorldMIDlet helloInstance;
Form mainfrm = new Form("platformRequest 測試");
String telStr = "15879180878";
String urlStr = "http://wap.sina.com";
Command dialCmd, linkCmd;
public HelloWorldMIDlet() {
helloInstance = this;
mainfrm.append("要呼叫的號碼為:\n");
mainfrm.append(telStr);
mainfrm.append("\n要連接WAP頁面為:\n");
mainfrm.append(urlStr);
linkCmd = new Command("連接", 7, 1);
dialCmd = new Command("撥號", 1, 2);
mainfrm.addCommand(dialCmd);
mainfrm.addCommand(linkCmd);
mainfrm.setCommandListener(this);
}
public void startApp() {
Display.getDisplay(this).setCurrent(mainfrm);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable d) {
if (c == dialCmd) {
try {
this.platformRequest("tel:" + telStr);
}
catch (ConnectionNotFoundException ex) {}
}
if (c == linkCmd) {
try {
this.platformRequest(urlStr);
}
catch (ConnectionNotFoundException ex) {}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -