Pessoal, estou começando a mexer com o java mobile e ai em baixo esta o meu primeiro codigo.
Ambos feito no eclipse e no netbeans, porem, ambos estao com o mesmo erro. Já tentei colocar abstract mas
ao aparecer a tela do emulador, nao aparece nada. Alguem poderia me dar um help?
public class PrimeiraMID extends MIDlet {
private Display Tdisplay;
TextBox box = null;
public PrimeiraMID() {
}
public void stardApp(){
Tdisplay = Display.getDisplay(this);
box = new TextBox("Primeiro Exemplo","Hello World", 20, 0);
Tdisplay.setCurrent(box);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
}
C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\PrimeiraMid\src\PrimeiraMID.java:5: PrimeiraMID is not abstract and does not override abstract method startApp() in javax.microedition.midlet.MIDlet
public class PrimeiraMID extends MIDlet {
Segue um exemplo de código que acredito que será grande ajuda. Esta aplicação apenas escreve “Hello World!” na tela.
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.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
/**
* This class is used to test basic execution of MIDLet HelloWorld.
*
* @author Alcides Flach
*
* @see javax.microedition.midlet.MIDlet
*/
public class HelloWorld extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Command exit;
/**
* Create an instance of the MIDlet HelloWorld.
*/
public HelloWorld() {
// call the super class constructor
super();
// create a command to finish the application
exit = new Command("EXIT", Command.EXIT, 1);
// create a form object
form = new Form("J2ME Testing");
// append the messege
form.append("Hello World!");
// add the command
form.addCommand(exit);
// set the form to listen the events
form.setCommandListener(this);
}
protected void startApp() throws MIDletStateChangeException {
// get the display instace of this MIDlet
display = Display.getDisplay(this);
// set the form object visible on the display
display.setCurrent(form);
}
public void commandAction(Command c, Displayable d) {
// verify if the command event is the exit command
if (c == exit) {
try {
// signals the MIDlet to terminate and enter the Destroyed state
destroyApp(false);
} catch (MIDletStateChangeException e) {
e.printStackTrace();
}
// notify the application management software that it has entered
// into the Destroyed state
notifyDestroyed();
}
}
protected void pauseApp() {
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
}
Oi RHKW o negocio seguinte, o seu metodo ta com nome trocado:
public void stardApp(){ deveria ser public void startApp(){ , tente inverter o nome. Blzinha??? Abraços.