无法在netbeans中执行命令错误

时间:2017-11-10 14:04:25

标签: java

我是netbeans和java的新手。请帮我解决这个问题

我需要卸载我的netbeans和java me然后重新安装吗?

我已经安装了java me sdk 3.4但是当我的程序说:

build-impl.xml:431:无法执行命令(这是错误) BUILD FAILED(总时间:0秒)

(这是build-impl.xml:431)

package sampleapp;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.*;


public class Midlet extends MIDlet implements CommandListener{

    private Form form;
    private Display display;
    private StringItem stringItemHelloWorld;
    private TextField textFieldInput;
    private Command getInputCommand;
    private Command exitCommand;
    public Midlet() {
        form = new Form("My Form");
        stringItemHelloWorld = new StringItem(null,"Hello World!");
        textFieldInput = new TextField("Name", null, 10, TextField.ANY);
        getInputCommand = new Command(
                "Get Input",
                Command.OK,
                1
        );
        exitCommand = new Command(
        "Exit", Command.EXIT, 2);
    }

    public void startApp() {
        display = Display.getDisplay(this);
        stringItemHelloWorld = new StringItem(null, "Hello World");
        form.append(stringItemHelloWorld);
        form.append(textFieldInput);
        form.addCommand(getInputCommand);
        form.setCommandListener(this);
        display.setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable d) {
        if (c== getInputCommand){
        Alert alert = new Alert("Name");
        alert.setString(textFieldInput.getString());
                    display.setCurrent(alert);
                    stringItemHelloWorld.setText(
                    textFieldInput.getString()
                );
    }
        else if(c== exitCommand){
            destroyApp(false);
            notifyDestroyed();
        }
}
}

0 个答案:

没有答案