Slide 3.14: User interface
  Slide 3.16: Lists (cont.)
  Home


Lists


The method startApp( ) starts the MIDlet by creating a list of items and associating the exit command with it.


  public void  startApp( )
      throws  MIDletStateChangeException {
    display = Display.getDisplay( this );
    menu = new List( "Test Components", Choice.IMPLICIT );
    menu.append( "Test TextBox", null );
    menu.append( "Test List", null );
    menu.append( "Test Alert", null );
    menu.append( "Test Date", null );
    menu.append( "Test Form", null );
    menu.addCommand( exitCommand );
    menu.setCommandListener( this );
    menu.setTicker( ticker );
    mainMenu( );

    // form
    form.append( gauge );
    form.append( textfield );

    // today
    today.append( date );
  }

  ...

  // main menu
  void  mainMenu( ) {
    display.setCurrent( menu );
    currentMenu = "Main";
  }


Click on Launch ——>


<—— Click on Exit