April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Exemplo J2ME (cont.)
n /**
n   * Handle events
n   */
n  public void commandAction(Command c, Displayable s) {
n    if ( c == exitCommand ) {
n      destroyApp(false); notifyDestroyed();
n    } else if ( c == backCommand ) {
n      list.setCommandListener(this); display.setCurrent(list);            
n    } else if ( c == aboutCommand ) {
n      textBox.setCommandListener(this); display.setCurrent(textBox);        
n    } else if ( c == propsCommand ) {
n      props.setCommandListener(this); display.setCurrent(props);      
n    } else {
n      if ( list.getSelectedIndex() == 0 ) {
n        textBox.setCommandListener(this); display.setCurrent(textBox);
n      } else if ( list.getSelectedIndex() == 1 ) {
n        props.setCommandListener(this); display.setCurrent(props);
n      } else {
n        display.setCurrent(alert);
n      }
n    }
n  }
n