title: Confused with command listeners and new forms J2ME
body: <p><strong>EDIT:</strong> <em>I believe I need help getting the selected element in the list I just managed<br>
  for it to display a new form but I'm having a lot of trouble finding code that works<br>with source 3.0.</em><br><br><br></p>
  
  <p>I've been trying to make a application that allows a user to select a date then add<br>
  and remove events based on the selected date. So far I have created the first screen<br>
  which is a list of option for the user to choose from.<br> These options are:</p>
  
  <ul>
  <li>Select Date</li>
  <li>Add Events</li>
  <li>Remove Events</li>
  <li>Browse Events</li>
  </ul>
  
  <p>The issues I'm having is I can't get my head around how to display new forms based on <br>the selected Item in the list. I found a small tutorial that allowed me to add a command<br>listener which shows the selected item  but I'm having trouble figuring out how it gets the<br> item selected in the list and how I could create a new form based on the item selected?</p>
  
  <p>Here's my code so far.</p>
  
  <pre><code>    import javax.microedition.lcdui.Alert;
      import javax.microedition.lcdui.AlertType;
      import javax.microedition.lcdui.Command;
      import javax.microedition.lcdui.CommandListener;
      import javax.microedition.lcdui.Display;
      import javax.microedition.lcdui.Displayable;
      import javax.microedition.lcdui.List;
      import javax.microedition.lcdui.Form;
      import javax.microedition.midlet.MIDlet;
  
      public class mainMidlet extends MIDlet implements CommandListener {
  
        private Display display;
        private List list = new List("Please Select a Option", List.IMPLICIT);
        private Command select = new Command("Select", Command.SCREEN, 1);
        private Form form;
        Alert alert;
  
        public mainMidlet() {
          display = Display.getDisplay(this);   
  
          list.append("Select Date", null);
          list.append("Add Events", null);
          list.append("Remove Events", null);
          list.append("Browse Events", null);
          list.addCommand(select);
          list.setCommandListener(this);
  
        }
  
        public void startApp() {
          display.setCurrent(list);
        }
  
        public void pauseApp() {
        }
  
        public void destroyApp(boolean unconditional) {
        }
  
        public void commandAction(Command command, Displayable displayable) {
          if (command == List.SELECT_COMMAND) {
            String selection = list.getString(list.getSelectedIndex());
            alert = new Alert("Option Selected", selection, null, null);
            alert.setTimeout(Alert.FOREVER);
            alert.setType(AlertType.INFO);
            display.setCurrent(alert);
          } else if (command == select) {
            destroyApp(false);
            notifyDestroyed();
          }
        }
      }
  </code></pre>