NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Application quit unexpectedly

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
Black Sparrow



Joined: 24 Aug 2013
Posts: 1

PostPosted: Sat Aug 24, 2013 5:17 am    Post subject: Application quit unexpectedly Reply with quote

Hi, I'm a newbie here and a beginner in Java ME. Could anyone here tell me what is the problem? When I run my program, the a message box is displayed saying ("The following application has unexpectedly quit").



package Q2;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.*;

/**
* @author sean
*/
public class Lab4Q2 extends MIDlet implements CommandListener{

private Display disp = Display.getDisplay(this);
private List converter;

public void startApp() {
disp.setCurrent(this.generateList());
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public Displayable generateList(){
converter = new List ("Converter", List.IMPLICIT, null, null);
converter.append("Mass and Weight", null);
converter.append("Distance and Length", null);
converter.append("Capacity and Volume", null);
converter.append("Area", null);
converter.append("Speed", null);
converter.append("Temperature", null);

Command cmdExit = new Command("Exit", Command.EXIT, 1);
Command cmdScreen = new Command("Option", Command.SCREEN, 1);
converter.addCommand(cmdExit);
converter.addCommand(cmdScreen);
converter.setCommandListener(this);
//converter.setItemStateListener(this);
return converter;

}

public void commandAction(Command c, Displayable d) {
if(c == List.SELECT_COMMAND){
switch (converter.getSelectedIndex()) {
case 0:
System.out.println("You selected Mass and Weight function");
break;
case 1:
System.out.println("You selected Distance and Length function");
break;
case 2:
System.out.println("You selected Capacity and Volume function");
break;
case 3:
System.out.println("You selected Area function");
break;
case 4:
System.out.println("You selected Speed function");
break;
case 5:
System.out.println("You selected Temperature function");
break;

// case Command.EXIT:
// destroyApp(true);
// notifyDestroyed();

}
}
}
}


Thanks
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
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 cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo