J2me アプリケーションでは、yes, no コマンドでアラートを使用しました。ユーザーが yes コマンドをクリックするとフォーム画面が表示され、no コマンドをクリックすると TextBox 画面が表示されます。しかし、コードは機能しません。2 つのコマンドの場合のみ、テキストボックス画面が表示されます。
これは私のコードです:
public Login(){
yes=new Command("Yes",Command.OK,1);
no=new Command("No",Command.CANCEL,1);
alert=new Alert("","Save The Changes?",null,AlertType.CONFIRMATION);
alert.setTimeout(Alert.FOREVER);
alert.addCommand(yes);
alert.addCommand(no);
textbox.setCommandListener(this);
alert.setCommanListener(this);
}
public void commandAction(Command command, Displayable displayable) {
if(displayable==textbox)
{
if(command==exit)
{
switchDisplayable(null,alert);
}
}
else if(displayable==alert)
{
if(command==no)
{
switchDisplayable(alert,getForm());
}
else if(command==yes)
{
switchDisplayable(alert,getTextbox());
}
}
}
私のせいはどこですか?