HelloScreen.java
/*
* Copyright © 2011 Nokia Corporation. All rights reserved.
* Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
* Oracle and Java are trademarks or registered trademarks of Oracle and/or its
* affiliates. Other product and company names mentioned herein may be trademarks
* or trade names of their respective owners.
* See LICENSE.TXT for license information.
*/
import javax.microedition.lcdui.*;
class HelloScreen
extends Form
implements CommandListener {
private final HelloWorldMIDlet midlet;
private final Command exitCommand; // Exit command for closing the MIDlet in the device UI.
public HelloScreen(HelloWorldMIDlet midlet, String string) {
super("");
StringItem helloText = new StringItem("", string);
super.append(helloText);
this.midlet = midlet;
exitCommand = new Command("Exit", Command.EXIT, 1);
addCommand(exitCommand);
setCommandListener(this);
}
public void commandAction(Command command, Displayable displayable) {
if (command == exitCommand) {
midlet.notifyDestroyed();
}
}
}