NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
forent
Joined: 09 Mar 2011 Posts: 3
|
Posted: Mon Mar 21, 2011 4:19 am Post subject: Form problem[help please] |
|
|
i just want to make form looping, form is Form number one and hasilForm is second one. i want to switch from "form" to "hasilForm" and get back to "form"
| Code: | public class loctest extends MIDlet implements CommandListener{
//private Display display;
loctest parent;
static Form form = new Form("LBS v0.01");
static Form hasilForm = new Form("LBS v0.01 Peta");
private Command cmdExit,cmdOK,cmdBack;
private StringItem si;
static String host = "localhost";
static String port = "9995";
Client klien=null;
TextField textToFind,textToFind2;
public loctest() throws IOException{
parent = this;
}
public void startApp(){
Display.getDisplay(this);
cmdExit = new Command("Exit",Command.EXIT,5);
cmdOK = new Command("OK",Command.OK,1);
cmdBack = new Command("Back", Command.BACK, 2);
si = new StringItem("Find", "Click OK");
textToFind = new TextField("Find What : ","",20,TextField.ANY);
textToFind2 = new TextField("Find What : ","",20,TextField.ANY);
form.append(textToFind);
form.addCommand(cmdExit);
form.addCommand(cmdOK);
form.setCommandListener(this);
//hasilForm.append(textToFind2);
hasilForm.addCommand(cmdExit);
hasilForm.addCommand(cmdBack);
Display.getDisplay(this).setCurrent(form);
}
public void pauseApp(){
}
public void destroyApp(boolean flag) {
notifyDestroyed();
}
public void commandAction(Command c, Displayable d){
if (c.getLabel().equals("OK")){
// Retriever ret = new Retriever(this);
// GoogleMaps peta = new GoogleMaps("bla...bla..bla");
// try {
//
// form.append(peta.retrieveStaticImage(200, 200, -6.891577010773676, 107.61048316955566, 14, "png32"));
// System.out.println(ret.lat+" "+ret.lon);
// form.addCommand(cmdBack);
// } catch (IOException ex) {
// ex.printStackTrace();
// }
// ret.start();
// ret.setRequest(textToFind.getString());
// ret.socket_localhost();
Display.getDisplay(this).setCurrent(hasilForm);
}
if (c.getLabel().equals("Back")) {
Display.getDisplay(this).setCurrent(form);
}
if(c.getLabel().equals("Exit")){
destroyApp(false);
}
//c.getLabel().equals("OK")
}
public void displayString(String string){
si.setText(string);
}
} |
this is the result..
| Quote: | TRACE: <at java.lang.NullPointerException: 0>, Exception caught in Display class
java.lang.NullPointerException: 0
at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46
at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74
at com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(), bci=37
at com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(), bci=36
at com.sun.midp.chameleon.CWindow.keyInput(), bci=38
at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=17
at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277
at com.sun.midp.events.EventQueue.run(), bci=179
at java.lang.Thread.run(Thread.java:662)
javacall_lifecycle_state_changed() lifecycle: event is JAVACALL_LIFECYCLE_MIDLET_SHUTDOWNstatus is JAVACALL_OK |
thanks anyway... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|