在midlet開發中
但是如何控制顯示不同的內容呢?如果是程序裡自動控制
其實思路也很簡單
package hello;
import javax
import javax
public class HelloMIDlet extends MIDlet implements CommandListener {
private Command exitCommand; // The exit command
private Command view;
private Display display; // The display for this MIDlet
private TextBox t;
private MyCanvas m;
public HelloMIDlet() {
display = Display
exitCommand = new Command(
view = new Command(
}
public void startApp() {
t = new TextBox(
t
t
t
MyCanvas m=new MyCanvas();
m
m
m
if (System
t
else
t
display
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
if (c==view && s = m)
{
display
}
}
}
以上代碼中
就這麼簡單
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26391.html