C:\eclipse\workspace\HelloWorld\src\HelloScreen.java
 1 import javax.microedition.lcdui.*;
 2 
 3 class HelloScreen extends TextBox implements CommandListener
 4 {
 5         private final HelloWorldMIDlet midlet;
 6         private final Command exitCommand;
 7 
 8         HelloScreen(HelloWorldMIDlet midlet, String string)
 9         {
10                 super("HelloWorldMIDlet", string, 256, 0);
11                 this.midlet = midlet;
12                 exitCommand = 
13                         new Command("Exit", Command.EXIT, 1);
14                 addCommand(exitCommand);
15                 setCommandListener(this);
16         }
17 
18         public void commandAction(Command c, Displayable d)
19         {
20                 if(c == exitCommand)
21                 {
22                         midlet.exitRequested();
23                 }
24         }
25 }
26