Slide 3.11: Line-by-line anatomy of HelloMIDlet.java (cont.)
  Slide 3.13: Line-by-line anatomy of HelloMIDlet.java (cont.)
  Home


Line-by-line Anatomy of HelloMIDlet.java (Cont.)


tbxMain = new TextBox("HelloMIDlet", "Hello, World!", 50, 0);
The constructor public javax.microedition.lcdui.TextBox(String title, String text, int maxSize, int constraints) creates a new TextBox object with the following parameters: tbxMain.addCommand(cmdExit);
The method public void javax.microedition.lcdui.Displayable.addCommand (Command cmd) adds a command to the Displayable. The implementation may choose, for example, to add the command to any of the available soft buttons or place it in a menu.

tbxMain.setCommandListener(this);
The method public void javax.microedition.lcdui.Displayable.setCommandListener (CommandListener l) sets a listener for Commands to this Displayable, replacing any previous CommandListener.

public void startApp( ) {
The MIDlet enters the Active state after the application manager calls startApp( ) via clicking on the button Launch.