Alguém sabe pq as ações dos botões do código abaixo não funciona?
Na linha 66 é ação do botão localizar que está na primeira tela que vai mostrar um form qualquer que possui dois botões ( voltar e sair ) só que ao clicar neles não há ação nenhuma.
Alguém sabe pq?
[code]/*
package textfield;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
/**
- The text field demo displays all of the text field types on the screen
- allowing the user to edit them at will.
-
@version 2.0
*/
public class TextFieldDemo extends MIDlet implements CommandListener {
private final static Command exitCommand = new Command("Exit", Command.EXIT, 1);
private final static Command localizar = new Command("Localizar", Command.SCREEN, 1);
private final static Command voltar = new Command("Voltar", Command.SCREEN, 1);
private boolean firstTime;
private Form mainForm;
private Form outroForm;
private Form form2;
public TextFieldDemo() {
firstTime = true;
}
protected void startApp() {
if (firstTime) {
mainForm = new Form("Text Field");
outroForm = new Form("Outro Form");
form2 = new Form("Form 2");
mainForm.append("This demo contains text fields each one " +
"with a different constraint");
mainForm.append(
new TextField("Any Character", "", 15, TextField.ANY));
mainForm.append(
new TextField("E-Mail", "", 15, TextField.EMAILADDR));
mainForm.append(new TextField("Number", "", 15, TextField.NUMERIC));
mainForm.append(
new TextField("Decimal", "", 15, TextField.DECIMAL));
mainForm.append(
new TextField("Phone", "", 15, TextField.PHONENUMBER));
mainForm.append(
new TextField("Password", "", 15, TextField.PASSWORD));
mainForm.append(new TextField("URL", "", 15, TextField.URL));
mainForm.addCommand(exitCommand);
mainForm.addCommand(localizar);
mainForm.setCommandListener(this);
firstTime = false;
}
Display.getDisplay(this).setCurrent(mainForm);
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}else
if( c == localizar){
outroForm.append(new TextField("Qualquer Coisa", "", 15, TextField.ANY));
outroForm.append(new TextField("Outra Coisa", "", 15, TextField.ANY));
outroForm.append(new TextField("Mais Outra Coisa", "", 15, TextField.ANY));
outroForm.addCommand(exitCommand);
outroForm.addCommand(voltar);
Display.getDisplay(this).setCurrent(outroForm);
}else
if( c == voltar){
form2.append(new TextField("Qualquer Coisa 2", "", 15, TextField.ANY));
form2.append(new TextField("Outra Coisa 2", "", 15, TextField.ANY));
form2.append(new TextField("Mais Outra Coisa 2", "", 15, TextField.ANY));
Display.getDisplay(this).setCurrent(form2);
}
}
protected void destroyApp(boolean unconditional) {
}
protected void pauseApp() {
}
}
[/code]
Obrigada