J
Jeff
Hey
J2ME Wireless Toolkit 2.2
JDK 5
My midlet below, doesn't exit when hitting the exit key, I'm not sure what
I'm doing wrong here... I've spent hours investigate the problem, but I
cannot see why it can't exit when pushing the exit key (exit key = the
right soft key.... I guess it's standard that the right soft key is the exit
button)
package com.test;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class chemistry extends MIDlet implements CommandListener
{
private static Display display;
private Command exitCommand = new Command("Exit", Command.EXIT, 99);
private Form form;
private StringItem lblWelcome;
private StringItem lblInfo;
public chemistry()
{
form = new Form("Chemistry");
//Add GUI elements:
lblInfo = new StringItem("Please make a selection", null);
lblInfo.setLayout(Item.LAYOUT_CENTER);
//Add commands
form.addCommand(exitCommand);
}
public void startApp()
{
Display display = Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
try
{
destroyApp(false);
notifyDestroyed();
}
catch (Exception ex)
{
}
}
}
}
I would be very thankful if someone could give me some tips about what I'm
doing wrong here....
Jeff
J2ME Wireless Toolkit 2.2
JDK 5
My midlet below, doesn't exit when hitting the exit key, I'm not sure what
I'm doing wrong here... I've spent hours investigate the problem, but I
cannot see why it can't exit when pushing the exit key (exit key = the
right soft key.... I guess it's standard that the right soft key is the exit
button)
package com.test;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class chemistry extends MIDlet implements CommandListener
{
private static Display display;
private Command exitCommand = new Command("Exit", Command.EXIT, 99);
private Form form;
private StringItem lblWelcome;
private StringItem lblInfo;
public chemistry()
{
form = new Form("Chemistry");
//Add GUI elements:
lblInfo = new StringItem("Please make a selection", null);
lblInfo.setLayout(Item.LAYOUT_CENTER);
//Add commands
form.addCommand(exitCommand);
}
public void startApp()
{
Display display = Display.getDisplay(this);
display.setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
try
{
destroyApp(false);
notifyDestroyed();
}
catch (Exception ex)
{
}
}
}
}
I would be very thankful if someone could give me some tips about what I'm
doing wrong here....
Jeff