📄 helloworld.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class helloworld extends MIDlet implements CommandListener{
private Command exitcommand;
private TextBox tb;
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#startApp()
*/
public helloworld(){
exitcommand=new Command("exit",Command.EXIT,1);
tb=new TextBox("hello midlet","hello,word",15,0);
tb.addCommand(exitcommand);
tb.setCommandListener(this);
}
protected void startApp() throws MIDletStateChangeException {
Display.getDisplay(this).setCurrent(tb);
System.out.println("startApp");
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#pauseApp()
*/
protected void pauseApp() {
// TODO Auto-generated method stub
System.out.println("pauseApp");
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
System.out.println("destoryApp");
}
/* (non-Javadoc)
* @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)
*/
public void commandAction(Command c, Displayable d) {
if(c == exitcommand){
try{
destroyApp(false);
}catch(MIDletStateChangeException exception){
System.out.println("MIDletStateChangeException");}
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -