我正在使用lwuit使用j2me我有一个问题就是
当我在midlet中startApp()
时,我首先设置了Display.init(this)
并且运行应用程序lwuit工作正常,但是当我在midlet中使用Form startApp()
事件时它工作得很好但是在这种形式的actionevent中我称之为新形式并且以这种新形式
当我按下它时,我放了一个后退命令它不会在主midlet上移动
请帮助知道如何使用
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
}
答案 0 :(得分:0)
它很简单。您可以在下一个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();
}
});
<强> NewForm.java 强>
// 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();
}
});
}