04-06-2009, 01:20 PM
|
#1 (permalink)
|
| New Member
Join Date: Apr 2009 Model: 8900 PIN: N/A Carrier: T-Mobile
Posts: 1
Post Thanks: 0 Thanked 0 Times in 0 Posts
| Trackball click on 8900 doesn't display list of commands Please Login to Remove! I have a simple Hello World program that adds an exit Command to a Form. When I load it on the 8900 and click on the trackball, nothing happens. The list of Commands for the Form is displayed only if I click on the trackball and scroll up, down, left or right.
Is there a way to display the list of Commands when the trackball is clicked?
This is my code:
package hello;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TestApp extends MIDlet implements CommandListener {
private boolean midletPaused = false;
private Command exitCommand;
private Form form;
private StringItem stringItem;
/**
* The HelloMIDlet constructor.
*/
public TestApp() {
}
/**
* Initializes the application.
*/
private void initialize() {
}
public void startMIDlet() {
switchDisplayable(null, getForm());
}
public void resumeMIDlet() {
}
public void switchDisplayable(Alert alert, Displayable nextDisplayable) {
Display display = getDisplay();
if (alert == null) {
display.setCurrent(nextDisplayable);
} else {
display.setCurrent(alert, nextDisplayable);
}
}
public void commandAction(Command command, Displayable displayable) {
if (displayable == form) {
if (command == exitCommand) {
exitMIDlet();
}
}
}
public Command getExitCommand() {
if (exitCommand == null) {
exitCommand = new Command("Exit", Command.EXIT, 0);
}
return exitCommand;
}
public Form getForm() {
if (form == null) {
form = new Form("Welcome", new Item[] { getStringItem() });
form.addCommand(getExitCommand());
form.setCommandListener(this);
}
return form;
}
public StringItem getStringItem() {
if (stringItem == null) {
stringItem = new StringItem("Hello", "Hello, World!");
}
return stringItem;
}
public Display getDisplay () {
return Display.getDisplay(this);
}
public void exitMIDlet() {
switchDisplayable (null, null);
destroyApp(true);
notifyDestroyed();
}
public void startApp() {
if (midletPaused) {
resumeMIDlet ();
} else {
initialize ();
startMIDlet ();
}
midletPaused = false;
}
public void pauseApp() {
midletPaused = true;
}
public void destroyApp(boolean unconditional) {
}
} |
| Offline
| |