title: How to call a form inside another form using JME
body: <p>I am trying to learn J2ME and I have a problem with forms. My problem is that I have two forms, a ‘main’ form and a ‘greetings’ form. I can’t figure out how to call the ‘greetings ‘form from the’ main’ form. I want once the midlet is launched; the greetings form is called directly by the main form. A sample of my code is shown below.</p>
  
  <p>This code is for the greetings Form (greetingsClass.java)</p>
  
  <pre><code>import javax.microedition.lcdui.*;
  
  public class greetingsClass {
  
  public Display greetingsDisplay;
  public Form loginform;
  
  public void login()
  {
      loginform = new Form("Login Class Form");
      loginform.append("Ok! Iside login Classs form");
      greetingsDisplay = Display.getDisplay(this);
      greetingsDisplay.setCurrent(loginform);
  
  }
  }
  </code></pre>
  
  <p>This code is for the main form (FormMIDlet.java)</p>
  
  <pre><code>import javax.microedition.midlet.MIDlet;
  import javax.microedition.lcdui.*;
  
  public class FormMIDlet extends MIDlet {
  
  public Display FormMIDletdisplay;
  public Form MainMIDletform;
  public LoginClass LoginFormObject;
  
  public void startApp() {
  MainMIDletform = new Form("Main Class Form");
  MainMIDletform.append("Calling LoginClass Form");
  FormMIDletdisplay = Display.getDisplay(this);
  FormMIDletdisplay.setCurrent(MainMIDletform);
  
  }
  
  public void pauseApp() {}
  
  public void destroyApp(boolean unconditional) {
  notifyDestroyed();
  }
  }
  </code></pre>
  
  <p>I want the form in the first part of the code (greetingsClass.java)<br>
   to be shown in the second part which is the mainform of the midlet (FormMIDlet.java).</p>