lcdui 与 lwuit 命令区别
我习惯使用 lcdui 界面,但我想使用 lwuit 界面。 谁能告诉我不同的命令列表。
package newpackage;
import java.io.IOException;
import javax.microedition.midlet.*;
import com.sun.lwuit.*;
import com.sun.lwuit.events.*;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
public class test extends MIDlet implements ActionListener {
Form mainform;
List list;
Command exit = new Command ("Exit");
public void startApp() {
Display.init(this);
try {
Resources r = Resources.open("/res/javaTheme.res");
UIManager.getInstance().setThemeProps(r.getTheme("javaTheme"));
} catch (IOException ioe) {
// Do something here.
}
mainform = new Form("MENU");
list = new List();
list.addItem("Remitting");
list.addItem("Paying");
list.addItem("Change Pin");
list.addItem("Inbox");
mainform.addComponent(list);
mainform.show();
mainform.addCommand(exit);
mainform.setCommandListener(this);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void actionPerformed(ActionEvent ae) {
if (ae.getCommand()== exit){
destroyApp(false);
notifyDestroyed();
}
if (ae.getSource()==list){
switch(list.getSelectedIndex()){
case 0:
Remitting();
break;
case 1:
Paying();
break;
case 2:
Changepin();
break;
case 3:
Inbox();
break;
}
i am used to working with lcdui interface but i want to work with lwuit interface.
Can any one tell me the different command list.
package newpackage;
import java.io.IOException;
import javax.microedition.midlet.*;
import com.sun.lwuit.*;
import com.sun.lwuit.events.*;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
public class test extends MIDlet implements ActionListener {
Form mainform;
List list;
Command exit = new Command ("Exit");
public void startApp() {
Display.init(this);
try {
Resources r = Resources.open("/res/javaTheme.res");
UIManager.getInstance().setThemeProps(r.getTheme("javaTheme"));
} catch (IOException ioe) {
// Do something here.
}
mainform = new Form("MENU");
list = new List();
list.addItem("Remitting");
list.addItem("Paying");
list.addItem("Change Pin");
list.addItem("Inbox");
mainform.addComponent(list);
mainform.show();
mainform.addCommand(exit);
mainform.setCommandListener(this);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void actionPerformed(ActionEvent ae) {
if (ae.getCommand()== exit){
destroyApp(false);
notifyDestroyed();
}
if (ae.getSource()==list){
switch(list.getSelectedIndex()){
case 0:
Remitting();
break;
case 1:
Paying();
break;
case 2:
Changepin();
break;
case 3:
Inbox();
break;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在添加到列表中。列表不是命令。两者是不同的。阅读这篇文章LWUIT 简介。
You are adding into List. List not a Command. Both are different. Read this article, Introduction about LWUIT.