Aboutus.java를 호출 할 때 MainMIDlet 양식 인스턴스를 전달하십시오. 예를 들어 ,
MainMIDlet.java
public class MainMIDlet extends MIDlet implements ActionListener {
Form form = new form();
...
...
public void actionPerformed(ActionEvent ae)
{
Command cmd = ae.getCommand();
String cmdname= cmd.getCommandName();
if (cmdname.equals("Aboutus"))
{
Aboutus aboutus = new Aboutus(form); // pass the current form
aboutus.show();
}
}
}
Aboutus.java
public class Aboutus extends Form implements ActionListener {
Form mainform;
public Aboutus(Form form) {
this.mainform = form;
...
...
Command backCommand = new Command("Back",null,1);
this.setBackCommand(backCommand);
}
...
...
public void actionPerformed(ActionEvent ae)
{
Command cmd = ae.getCommand();
String cmdname= cmd.getCommandName();
if (cmdname.equals("Back"))
{
mainform.showBack(); // show the Main Midlet form here
}
}
}
감사 bhakki yaar.You proovide 최고의 솔루션,하지만 다시이 명령을 클릭 할 때 문제가 아무 동작도 수행되지 않습니다. ieMainMIDlet 폼을 표시 할 수 없습니다. MainMIDlet 클래스에서 모든 구성 요소는 MainMIDlet [Form form = new Form()]의 폼 객체를 사용하여 추가됩니다. 문제가 뭐야? plz 줄 soltion.THANK U –
@ Jeevan : 당신은 두 번째 양식에'addCommandListener'을 추가 했습니까? – bharath
고맙습니다.이 방법을 잊어 버렸습니다. 다시 한번 고마워. 돌봐. –