 import javax.microedition.midlet.*;
 import javax.microedition.lcdui.*; 
 
 public class Sura extends MIDlet implements CommandListener
 {
     private Display display;
     private TextField userName;
     private TextField password;
     private Form form;
     private Command cancel;
     private Command login;
     private Command cmdNext;
     private Command cmdBack;
   // Constructor
   public Sura() {
      userName = new TextField("LoginID:", "", 10, TextField.ANY);
      password = new TextField("Password:", "", 10, TextField.PASSWORD);
      form     = new Form("Sign in");
      cancel   = new Command("Cancel", Command.CANCEL,2);
      login    = new Command("Login", Command.OK,2);
      cmdNext  = new Command("Next", Command.SCREEN,2);
      cmdBack  = new Command("Back", Command.SCREEN,2);
   }

   // MIDlet lifecycle method: called when the MIDlet is started
   public void startApp() {
      display = Display.getDisplay(this);
      form.append(userName);
      form.append(password);
      form.addCommand(cancel);
      form.addCommand(login);
      form.setCommandListener(this);
      display.setCurrent(form);
   }

   // MIDlet lifecycle method: called when MIDlet is paused

   public void pauseApp() {
   }

   // MIDlet lifecycle method: called when the MIDlet is destroyed
   public void destroyApp(boolean unconditional) {
      notifyDestroyed();
   }

   // Checks if the user enters the correct account information
   public void validateUser(String name, String password) {
     if (name.equals("h") && password.equals("h")) {
       menu();
     } else {
       tryAgain();
     }
   }     

   // Display a list of services
   public void menu() {
     Form frm = new Form("التوحيد");
     frm.append("قل هو الله احد* الله الصمد*لم يلد ولم يولد*\n");
     frm.append("ولم يكن له كفوا احد*");
     frm.addCommand(cmdNext);
     frm.addCommand(cancel);
     frm.setTicker(new Ticker("    اللهم اغفر لنا ذنوبنا يا ارحم الرحيم"));
     frm.setCommandListener(this);
     display.setCurrent(frm);
   }

   // Display an error message if the user enters the incorrect account info
   public void tryAgain() {
     Alert error = new Alert("Login Incorrect", "Please try again", null, AlertType.ERROR);
     error.setTimeout(Alert.FOREVER);
     userName.setString("");
     password.setString("");
     display.setCurrent(error, form);
   }


   // Handle events
    public void commandAction(Command c, Displayable d) {
      String label = c.getLabel();
      if(label.equals("Cancel")) {
        destroyApp(true);
      } else if(label.equals("Login")) {
         validateUser(userName.getString(), password.getString());
      }
      else
      if(label.equals("Next"))
      {
      	Form frm1 = new Form("الكوثر");
        frm1.append("انا اعطيناك الكوثر*فصل لربك وانحر *  ان شانئك  هو الابتر");
        frm1.addCommand(cmdBack);
        frm1.addCommand(cancel);
        frm1.setTicker(new Ticker("    اللهم اغفر لنا ذنوبنا يا ارحم الرحيم"));
        frm1.setCommandListener(this);
        display.setCurrent(frm1);
      }
      
      else if(label.equals("Back")){menu();}
      
      
   }
   

 } 