开发者

lcdui vs lwuit command difference

开发者 https://www.devze.com 2023-03-17 11:33 出处:网络
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.

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 ("E开发者_C百科xit");



 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;
    }


You are adding into List. List not a Command. Both are different. Read this article, Introduction about LWUIT.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号