Java me 使用lwuit UI库,我不会破坏j2me应用程序

Java me 使用lwuit UI库,我不会破坏j2me应用程序,java-me,lwuit,lwuit-form,Java Me,Lwuit,Lwuit Form,我正在使用lwuit处理j2me,我有一个问题是 当我startApp()在midlet内部时,我首先设置Display.init(this) 并运行应用程序Lwit工作正常,但当我在midlet中使用表单insidestartApp()event时,它工作正常,但在这个表单actionevent中,我被称为新表单和新表单 当我按下一个后退命令时,它不会在主midlet上移动 请帮助了解如何使用lwuit import javax.microedition.MIDlet; import so

我正在使用lwuit处理j2me,我有一个问题是

当我
startApp()
在midlet内部时,我首先设置
Display.init(this)

并运行应用程序Lwit工作正常,但当我在midlet中使用表单inside
startApp()
event时,它工作正常,但在这个表单actionevent中,我被称为新表单和新表单 当我按下一个后退命令时,它不会在主midlet上移动

请帮助了解如何使用lwuit

import javax.microedition.MIDlet;

import  some lwuit UILibrary

public class mainMiddlet extends MIDlet implement ActionListner
{
      public mainMiddlet(){
                  try{

                       Display.init(this);
                       //somthing is here 
                       form=new Form();

                       form.addActionListener(this);

                     }catch(Exception e){}
       }
       public void actionperformed(ActionEven ae){
                //here i call new form 
                //in action event of this form 
                new form().show();
        }
       //here some middlet default method 


}
public class newForm extends Form {

    //in this form I am put one command back and when i am pressed it 
    // I call mainMiddlet but it throw error internal application java.lang.nullpointer
   // can I back on mainmiddlet from on form to another form 
   // my main problem is I am not move on mainmiddlet for exit middlet because destoryall()
   // is method of middlet 

}

这很简单。您可以在下一个form back命令中调用
show()
方法。比如说,

MainMidlet.java

// create the midlet and write inside of the midlet
final Form form = new Form();

form.addCommand(new Command("Next") {

    public void actionPerformed(ActionEvent evt) {
            new NewForm(form).show();
       }
    });
   // create the NewForm class and write inside of the class

        public NewForm(final Form form) {
   // Constructor
        addCommand(new Command("Back") {

            public void actionPerformed(ActionEvent evt) {
                    form.show();
               }
            });
    }
NewForm.java

// create the midlet and write inside of the midlet
final Form form = new Form();

form.addCommand(new Command("Next") {

    public void actionPerformed(ActionEvent evt) {
            new NewForm(form).show();
       }
    });
   // create the NewForm class and write inside of the class

        public NewForm(final Form form) {
   // Constructor
        addCommand(new Command("Back") {

            public void actionPerformed(ActionEvent evt) {
                    form.show();
               }
            });
    }

你添加命令了吗?我不懂你的编码?这是你的全部代码吗?是的,我添加命令我的问题是,当mainmidlet启动时,我可以从上面的另一个表单命令事件中删除我的代码中的mainmidlet,然后我添加一个命令,当我按下它时,移动到另一个表单(新表单)但是从那里我不能回到mainMiddlet,它抛出错误java.lang.error.NullPointHereException谢谢大家的考虑,但是当我调用form.show()时,它是一个扩展了midlet类的对象,所以当我按下上面代码中提到的新form back命令时,它将抛出异常java.lang.nullpointe异常,请帮助我。。。。。。。。。。。。。。