Hallo.
Ich hab eine Anwendung gemacht und der Kompiler sagt:
Project settings saved
Building "WordGame-Surprise"
C:\Programme\Java\WTK\apps\WordGame-Surprise\src\WordGameSurprise.java:4: class WordGame is public, should be declared in a file named WordGame.java
public class WordGame extends MIDlet implements CommandListener
^
1 error
com.sun.kvem.ktools.ExecutionException
Build failed
Warum geht das nicht?
Das ist der verwendete Code :
Weis vieleicht jemand eine Antwort?
Danke im Voraus.
Gruß, Siegfried .
Ich hab eine Anwendung gemacht und der Kompiler sagt:
Project settings saved
Building "WordGame-Surprise"
C:\Programme\Java\WTK\apps\WordGame-Surprise\src\WordGameSurprise.java:4: class WordGame is public, should be declared in a file named WordGame.java
public class WordGame extends MIDlet implements CommandListener
^
1 error
com.sun.kvem.ktools.ExecutionException
Build failed
Warum geht das nicht?
Das ist der verwendete Code :
Code:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class WordGame extends MIDlet implements CommandListener
{
Display display;
Command menu1 = new Command("A",Command.ITEM,1);
Command menu2 = new Command("B",Command.ITEM,1);
Command menu3 = new Command("C",Command.ITEM,1);
Command menu4 = new Command("D",Command.ITEM,1);
Command menu5 = new Command("E",Command.ITEM,1);
Command menu6 = new Command("F",Command.ITEM,1);
Command menu7 = new Command("G",Command.ITEM,1);
Command menu8 = new Command("H",Command.ITEM,1);
Command menuE = new Command("Schließen",Command.EXIT,1);
Form Window = new Form("WordGame-Surprise");
public WordGame()
{
Window.append("Text...");
Window.addCommand(menu1);
Window.addCommand(menu2);
Window.addCommand(menu3);
Window.addCommand(menu4);
Window.addCommand(menu5);
Window.addCommand(menu6);
Window.addCommand(menu7);
Window.addCommand(menu8);
Window.addCommand(menuE);
Window.setCommandListener(this);
}
protected void startApp()
throws MIDletStateChangeException
{
display=Display.getDisplay(this);
display.setCurrent(Window);
}
protected void pauseApp()
{
}
protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException
{
}
public void commandAction(Command C, Displayable da)
{
if (C==menuE) notifyDestroyed();
else if (C==menu1) Window.append("A");
else if (C==menu2) Window.append("B");
else if (C==menu3) Window.append("C");
else if (C==menu4) Window.append("D");
else if (C==menu5) Window.append("E");
else if (C==menu6) Window.append("F");
else if (C==menu7) Window.append("G");
else if (C==menu8) Window.append("H");
}
}
Weis vieleicht jemand eine Antwort?
Danke im Voraus.
Gruß, Siegfried .