Ejemplo n.º 1
0
  protected void startApp() throws MIDletStateChangeException {
    // TODO Auto-generated method stub

    // mDisplay.setCurrent(mForm);
    CCL.mDisplay.setCurrent(new HomeScreenCanvas());
    mCanvas = new HomeScreenCanvas();
    mCanvas.setTitle("Celebrity Cricket League");
    mCanvas.addCommand(home);
    mCanvas.addCommand(videos);
    mCanvas.addCommand(team);
    mCanvas.addCommand(photos);
    mCanvas.addCommand(schedule);
    mCanvas.addCommand(ownerlounge);
    mCanvas.setCommandListener(this);
    hideOpenKeypadCommand();

    mDisplay.setCurrent(mCanvas);
    // mDisplay.setCurrent(new HomeScreenCanvas());
    Pform = new Form("Photo Albums");
    Pform.addCommand(backCommand);
    Pform.setCommandListener(this);

    Vform = new Form("Video Albums");
    Vform.addCommand(backCommand);
    Vform.setCommandListener(this);

    mList.addCommand(backCommand);
    mList.setCommandListener(this);
  }
Ejemplo n.º 2
0
 public void startApp() {
   display = Display.getDisplay(this);
   Form form = new Form("Date Field");
   form.append(datein);
   form.append(dateout);
   display.setCurrent(form);
 }
Ejemplo n.º 3
0
  /**
   * Display the connecting form to the user, let call set actions.
   *
   * @param action action to put in the form's title
   * @param name name to in the form's title
   * @param url URL of a JAD
   * @param size 0 if unknown, else size of object to download in K bytes
   * @param gaugeLabel label for progress gauge
   * @return displayed form
   */
  private Form displayProgressForm(
      String action, String name, String url, int size, String gaugeLabel) {
    Gauge progressGauge;
    StringItem urlItem;

    progressForm = new Form(null);

    progressForm.setTitle(action + " " + name);

    if (size <= 0) {
      progressGauge = new Gauge(gaugeLabel, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING);
    } else {
      progressGauge = new Gauge(gaugeLabel, false, size, 0);
    }

    progressGaugeIndex = progressForm.append(progressGauge);

    if (url == null) {
      urlItem = new StringItem("", "");
    } else {
      urlItem = new StringItem(Resource.getString(ResourceConstants.AMS_WEBSITE) + ": ", url);
    }

    progressUrlIndex = progressForm.append(urlItem);

    display.setCurrent(progressForm);
    lastDisplayChange = System.currentTimeMillis();

    return progressForm;
  }
Ejemplo n.º 4
0
  /**
   * Update URL and gauge of the progress form.
   *
   * @param url new URL, null to remove, "" to not change
   * @param size 0 if unknown, else size of object to download in K bytes
   * @param gaugeLabel label for progress gauge
   */
  private void updateProgressForm(String url, int size, String gaugeLabel) {
    Gauge oldProgressGauge;
    Gauge progressGauge;
    StringItem urlItem;

    // We need to prevent "flashing" on fast development platforms.
    while (System.currentTimeMillis() - lastDisplayChange < GraphicalInstaller.ALERT_TIMEOUT) ;

    if (size <= 0) {
      progressGauge = new Gauge(gaugeLabel, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING);
    } else {
      progressGauge = new Gauge(gaugeLabel, false, size, 0);
    }

    oldProgressGauge = (Gauge) progressForm.get(progressGaugeIndex);
    progressForm.set(progressGaugeIndex, progressGauge);

    // this ends the background thread of gauge.
    oldProgressGauge.setValue(Gauge.CONTINUOUS_IDLE);

    if (url == null) {
      urlItem = new StringItem("", "");
      progressForm.set(progressUrlIndex, urlItem);
    } else if (url.length() != 0) {
      urlItem = new StringItem(Resource.getString(ResourceConstants.AMS_WEBSITE) + ": ", url);
      progressForm.set(progressUrlIndex, urlItem);
    }

    lastDisplayChange = System.currentTimeMillis();
  }
Ejemplo n.º 5
0
  public void showAllRecordForm() {
    fmAllRecords = new Form("All records");
    try {
      RecordEnumeration recEnum = rs.enumerateRecords(null, null, false);
      while (recEnum.hasNextElement()) {
        try {
          // System.out.println(new String(recEnum.nextRecord()));
          String name = "Nenacetl jsem";
          int number = 0;
          try {
            byte[] record = recEnum.nextRecord();
            ByteArrayInputStream buffer = new ByteArrayInputStream(record);
            DataInputStream dis = new DataInputStream(buffer);
            name = dis.readUTF();
            number = dis.readInt();
            dis.close();
          } catch (Exception e) {
          }

          fmAllRecords.append(name + " " + String.valueOf(number) + "\n");
        } catch (Exception e) {
          System.out.println(e.getMessage());
        }

        //
      }
    } catch (Exception ex) {
      System.out.println(ex.getMessage());
    }
    fmAllRecords.addCommand(cmdMenu);
    fmAllRecords.setCommandListener(this);
    dsp.setCurrent(fmAllRecords);
  }
Ejemplo n.º 6
0
  public TrafficCams(Controller controller) {
    super("Traffic Status", Choice.EXCLUSIVE);

    this.controller = controller;
    traf = this;

    TrafOption = new Command("OK", Command.SCREEN, 1);
    bckMenu = new Command("back", Command.BACK, 2);

    VehicleOk = new Command("OK", Command.SCREEN, 1);
    Vehicleback = new Command("Back", Command.BACK, 2);

    this.addCommand(TrafOption);
    this.addCommand(bckMenu);
    setCommandListener(this);

    if (fmViewPng == null) {
      fmViewPng = new Form("");
      cmBack = new Command("Back", Command.BACK, 1);
      RefreshImage = new Command("refresh", Command.OK, 2);
      fmViewPng.addCommand(cmBack);
      fmViewPng.addCommand(RefreshImage);
      fmViewPng.setCommandListener(this);
    }
  }
  private void createForm(
      final Display display, String room, String server, String nick, final String password) {
    this.display = display;
    parentView = display.getCurrent();

    Form formJoin = new Form(SR.MS_JOIN_CONFERENCE);

    roomField = new TextField(SR.MS_ROOM, room, 64, ConstMIDP.TEXTFIELD_URL);
    TextFieldCombo.setLowerCaseLatin(roomField);
    formJoin.append(roomField);

    hostField = new TextField(SR.MS_AT_HOST, server, 64, ConstMIDP.TEXTFIELD_URL);
    TextFieldCombo.setLowerCaseLatin(hostField);
    formJoin.append(hostField);

    if (nick == null) nick = sd.account.getNickName();
    nickField = new TextFieldCombo(SR.MS_NICKNAME, nick, 32, TextField.ANY, "roomnick", display);
    formJoin.append(nickField);

    passField =
        new TextField(SR.MS_PASSWORD, password, 32, TextField.ANY | ConstMIDP.TEXTFIELD_SENSITIVE);
    formJoin.append(passField);

    msgLimitField = new NumberField(SR.MS_MSG_LIMIT, 20, 0, 20);
    formJoin.append(msgLimitField);

    formJoin.addCommand(cmdJoin);
    // formJoin.addCommand(cmdBookmarks);
    formJoin.addCommand(cmdAdd);

    formJoin.addCommand(cmdCancel);
    formJoin.setCommandListener(this);
    display.setCurrent(formJoin);
  }
Ejemplo n.º 8
0
 public void startApp() {
   if (mForm == null) {
     mForm = new Form(mAppID);
     mNumberEntry = new TextField("Connect To:", null, 256, TextField.PHONENUMBER);
     try {
       mInitialImage = Image.createImage(DEFAULT_IMAGE);
     } catch (Exception e) {
       System.out.println("start app err");
       e.printStackTrace();
     }
     mColorSquare =
         new ImageItem(null, mInitialImage, ImageItem.LAYOUT_DEFAULT, "waiting for image");
     mForm.append(mNumberEntry);
     mForm.append(mColorSquare);
     mForm.addCommand(mRedCommand);
     mForm.addCommand(mExitCommand);
     mForm.addCommand(mBlueCommand);
     mForm.setCommandListener(this);
   }
   Display.getDisplay(this).setCurrent(mForm);
   try {
     conn = (MessageConnection) Connector.open("mms://:" + mAppID);
     conn.setMessageListener(this);
   } catch (Exception e) {
     System.out.println("" + e);
   }
   if (conn != null) {
     startReceive();
   }
 }
Ejemplo n.º 9
0
 public Form getF_welcome() {
   if (f_welcome == null) {
     f_welcome = new Form("NGCalc 2.4.3 \u00A9 Revzin", new Item[] {getImageItem()});
     f_welcome.addCommand(getC_canvas());
     f_welcome.setCommandListener(this);
   }
   return f_welcome;
 }
Ejemplo n.º 10
0
 /** Shows the downloaded image. */
 void showImage(Image img, String imgName) {
   imageScreen.deleteAll();
   imageScreen.append(
       new ImageItem(
           imgName,
           img,
           ImageItem.LAYOUT_CENTER | ImageItem.LAYOUT_VCENTER,
           "Downloaded image: " + imgName));
   Display.getDisplay(parent).setCurrent(imageScreen);
 }
Ejemplo n.º 11
0
  public Form getForm() {
    if (form == null) {

      form = new Form("form");
      form.addCommand(getC_tovars());
      form.addCommand(getC_history());
      form.setCommandListener(this);
    }
    return form;
  }
Ejemplo n.º 12
0
 public InputText(String str) {
   Form form = new Form("請輸入" + str);
   if (page == 0) txt = new TextField(str, "", 10, TextField.ANY);
   else if (page == 2) txt = new TextField(str, "", 5, TextField.ANY);
   okCommand = new Command("確定", Command.OK, 1);
   form.append(txt);
   form.addCommand(okCommand);
   form.setCommandListener(this);
   display.setCurrent(form);
 }
Ejemplo n.º 13
0
 /**
  * This method returns instance for StartFailedForm component and should be called instead of
  * accessing StartFailedForm field directly.//GEN-BEGIN:MVDGetBegin19
  *
  * @return Instance for StartFailedForm component
  */
 public Form get_StartFailedForm() {
   if (StartFailedForm == null) { // GEN-END:MVDGetBegin19
     // Insert pre-init code here
     StartFailedForm = new Form(null, new Item[] {get_stringItem3()}); // GEN-BEGIN:MVDGetInit19
     StartFailedForm.addCommand(get_okCommand2());
     StartFailedForm.setCommandListener(this); // GEN-END:MVDGetInit19
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd19
   return StartFailedForm;
 } // GEN-END:MVDGetEnd19
Ejemplo n.º 14
0
 /**
  * This method returns instance for BTOffForm component and should be called instead of accessing
  * BTOffForm field directly.//GEN-BEGIN:MVDGetBegin16
  *
  * @return Instance for BTOffForm component
  */
 public Form get_BTOffForm() {
   if (BTOffForm == null) { // GEN-END:MVDGetBegin16
     // Insert pre-init code here
     BTOffForm = new Form(null, new Item[] {get_stringItem2()}); // GEN-BEGIN:MVDGetInit16
     BTOffForm.addCommand(get_okCommand2());
     BTOffForm.setCommandListener(this); // GEN-END:MVDGetInit16
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd16
   return BTOffForm;
 } // GEN-END:MVDGetEnd16
Ejemplo n.º 15
0
 /**
  * This method returns instance for helpForm component and should be called instead of accessing
  * helpForm field directly.//GEN-BEGIN:MVDGetBegin25
  *
  * @return Instance for helpForm component
  */
 public Form get_helpForm() {
   if (helpForm == null) { // GEN-END:MVDGetBegin25
     // Insert pre-init code here
     helpForm = new Form(null, new Item[] {get_stringItem4()}); // GEN-BEGIN:MVDGetInit25
     helpForm.addCommand(get_okCommand2());
     helpForm.setCommandListener(this); // GEN-END:MVDGetInit25
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd25
   return helpForm;
 } // GEN-END:MVDGetEnd25
Ejemplo n.º 16
0
 /**
  * This method returns instance for NoBTAPIForm component and should be called instead of
  * accessing NoBTAPIForm field directly.//GEN-BEGIN:MVDGetBegin43
  *
  * @return Instance for NoBTAPIForm component
  */
 public Form get_NoBTAPIForm() {
   if (NoBTAPIForm == null) { // GEN-END:MVDGetBegin43
     // Insert pre-init code here
     NoBTAPIForm = new Form(null, new Item[] {get_stringItem8()}); // GEN-BEGIN:MVDGetInit43
     NoBTAPIForm.addCommand(get_exitCommand());
     NoBTAPIForm.setCommandListener(this); // GEN-END:MVDGetInit43
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd43
   return NoBTAPIForm;
 } // GEN-END:MVDGetEnd43
Ejemplo n.º 17
0
 /**
  * This method returns instance for PrevNotClosedForm component and should be called instead of
  * accessing PrevNotClosedForm field directly.//GEN-BEGIN:MVDGetBegin46
  *
  * @return Instance for PrevNotClosedForm component
  */
 public Form get_PrevNotClosedForm() {
   if (PrevNotClosedForm == null) { // GEN-END:MVDGetBegin46
     // Insert pre-init code here
     PrevNotClosedForm = new Form(null, new Item[] {get_stringItem5()}); // GEN-BEGIN:MVDGetInit46
     PrevNotClosedForm.addCommand(get_okCommand2());
     PrevNotClosedForm.setCommandListener(this); // GEN-END:MVDGetInit46
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd46
   return PrevNotClosedForm;
 } // GEN-END:MVDGetEnd46
Ejemplo n.º 18
0
 /**
  * This method returns instance for NoBTForm component and should be called instead of accessing
  * NoBTForm field directly.//GEN-BEGIN:MVDGetBegin11
  *
  * @return Instance for NoBTForm component
  */
 public Form get_NoBTForm() {
   if (NoBTForm == null) { // GEN-END:MVDGetBegin11
     // Insert pre-init code here
     NoBTForm = new Form(null, new Item[] {get_stringItem1()}); // GEN-BEGIN:MVDGetInit11
     NoBTForm.addCommand(get_okCommand2());
     NoBTForm.setCommandListener(this); // GEN-END:MVDGetInit11
     // Insert post-init code here
   } // GEN-BEGIN:MVDGetEnd11
   return NoBTForm;
 } // GEN-END:MVDGetEnd11
Ejemplo n.º 19
0
  public void commandAction(Command c, Displayable d) {
    if (c == startCmd) {
      form.deleteAll();
      form.removeCommand(startCmd);
      form.addCommand(byeCmd);

      Thread t =
          new Thread() {

            public void run() {
              startSession();
            }
          };
      t.start();

      //	    startSession();
      return;
    } else if (c == exitCmd) {
      destroyApp(true);
      return;
    } else if (c == byeCmd) {
      form.removeCommand(byeCmd);
      form.addCommand(restartCmd);
      sendBYE();
      return;
    } else if (c == restartCmd) {
      stopListener();
      form.removeCommand(restartCmd);
      form.addCommand(startCmd);
      form.deleteAll();
      form.append(address);
      return;
    }
  }
Ejemplo n.º 20
0
 public void addRecordForm() {
   fmAddRecord = new Form("Add Record");
   txfName = new TextField("Name", "", 10, TextField.ANY);
   txfNumber = new TextField("Number", "", 10, TextField.NUMERIC);
   fmAddRecord.append(txfName);
   fmAddRecord.append(txfNumber);
   fmAddRecord.addCommand(cmdAdd);
   fmAddRecord.addCommand(cmdMenu);
   fmAddRecord.setCommandListener(this);
   dsp.setCurrent(fmAddRecord);
 }
Ejemplo n.º 21
0
 private void createAboutForm() {
   form = new Form(tr.t(Translator.ABOUT));
   form.setCommandListener(this);
   form.addCommand(backCommand);
   StringBuffer sb = new StringBuffer();
   sb.append(content.title).append(" by ").append(content.vendor).append('\n');
   sb.append("Version: ").append(content.version);
   sb.append("\nContent copyrights:").append(content.copyrights);
   sb.append("\n\nCreated using Creomobile Framework");
   form.append(sb.toString());
 }
Ejemplo n.º 22
0
 public void getNumberRecord() {
   fmNumbers = new Form("Number of Records");
   int number = 0;
   try {
     number = rs.getNumRecords();
   } catch (Exception e) {
   }
   fmNumbers.append("Numbers of Records: " + number);
   dsp.setCurrent(fmNumbers);
   fmNumbers.setCommandListener(this);
   fmNumbers.addCommand(cmdMenu);
 }
Ejemplo n.º 23
0
 /** Constructs client GUI. */
 GUIImageClient(DemoMIDlet parent) {
   this.parent = parent;
   bt_client = new BTImageClient(this);
   mainScreen.addCommand(SCR_MAIN_BACK_CMD);
   mainScreen.addCommand(SCR_MAIN_SEARCH_CMD);
   mainScreen.setCommandListener(this);
   listScreen.addCommand(SCR_IMAGES_BACK_CMD);
   listScreen.addCommand(SCR_IMAGES_LOAD_CMD);
   listScreen.setCommandListener(this);
   imageScreen.addCommand(SCR_SHOW_BACK_CMD);
   imageScreen.setCommandListener(this);
 }
Ejemplo n.º 24
0
 public void startApp() {
   display = Display.getDisplay(this);
   try {
     form.append(img);
   } catch (Exception e) {
   }
   form.append(userName);
   form.append(password);
   form.addCommand(cancel);
   form.addCommand(login);
   form.setCommandListener(this);
   display.setCurrent(form);
 }
Ejemplo n.º 25
0
  public Form getForm() {
    Form f = new Form(title);

    cmdVoltar = new Command("Voltar", Command.BACK, 1);

    StringItem strOpcoes = new StringItem(title, text);

    f.append(strOpcoes);

    f.addCommand(cmdVoltar);
    f.setCommandListener(listener);
    return f;
  }
Ejemplo n.º 26
0
  /** Creates a new instance of PrivacyForm */
  public PrivacyForm(Display display, PrivacyItem item, PrivacyList plist) {
    this.display = display;
    parentView = display.getCurrent();
    this.item = item;
    targetList = plist;

    textValue = new TextField(null, item.value, 64, ConstMIDP.TEXTFIELD_URL);
    TextFieldCombo.setLowerCaseLatin(textValue);

    form.append(choiceAction);
    choiceAction.setSelectedIndex(item.action, true);

    form.append(choiseType);

    form.append(textValue);
    choiseType.setSelectedIndex(item.type, true);
    switchType();

    form.append(choiseStanzas);
    choiseStanzas.setSelectedFlags(item.stanzasSet);

    // form.append("Order: "+item.order);

    form.setItemStateListener(this);
    form.setCommandListener(this);
    form.addCommand(cmdOk);
    form.addCommand(cmdCancel);
    display.setCurrent(form);
  }
Ejemplo n.º 27
0
 public OriginatingINVITE() {
   // <i><b>Initialize MIDlet display</b></i>
   display = Display.getDisplay(this);
   // <i><b>create a Form for progess info printings</b></i>
   form = new Form("Session example");
   address = new TextField("INVITE:", "sip:[email protected]:5070", 40, TextField.LAYOUT_LEFT);
   form.append(address);
   byeCmd = new Command("Bye", Command.ITEM, 1);
   restartCmd = new Command("Restart", Command.ITEM, 1);
   startCmd = new Command("Start", Command.ITEM, 1);
   form.addCommand(startCmd);
   exitCmd = new Command("Exit", Command.EXIT, 1);
   form.addCommand(exitCmd);
   form.setCommandListener(this);
 }
Ejemplo n.º 28
0
 /**
  * Returns an initialized instance of inputForm component.
  *
  * @return the initialized component instance
  */
 public Form getInputForm() {
   if (inputForm == null) {
     // GEN-END:|14-getter|0|14-preInit
     // write pre-init user code here
     inputForm =
         new Form(
             "Guess the number!",
             new Item[] {getStringItem(), getInputNumber()}); // GEN-BEGIN:|14-getter|1|14-postInit
     inputForm.addCommand(getOkCommand());
     inputForm.addCommand(getExitCommand());
     inputForm.setCommandListener(this); // GEN-END:|14-getter|1|14-postInit
     // write post-init user code here
   } // GEN-BEGIN:|14-getter|2|
   return inputForm;
 }
Ejemplo n.º 29
0
  public SnapperMIDlet() {
    mExitCommand = new Command("Exit", Command.EXIT, 0);
    mCameraCommand = new Command("Camera", Command.SCREEN, 0);
    mBackCommand = new Command("Back", Command.BACK, 0);
    mCaptureCommand = new Command("Capture", Command.SCREEN, 0);

    mMainForm = new Form("Snapper");
    mMainForm.addCommand(mExitCommand);
    String supports = System.getProperty("video.snapshot.encodings");
    if (supports != null && supports.length() > 0) {
      mMainForm.append("Ready to take pictures.");
      mMainForm.addCommand(mCameraCommand);
    } else mMainForm.append("Snapper cannot use this " + "device to take pictures.");
    mMainForm.setCommandListener(this);
  }
  //  private final TextEditor txt1;
  // private ImageItem imagen;
  // private TextBox txt;
  public Ayuda(Inicio midlet, String string) {
    super("");

    Orientation.addOrientationListener(this);

    StringItem helloText = new StringItem("", string);
    super.append(helloText);
    this.midlet = midlet;
    exitCommand = new Command("Salir", Command.SCREEN, 1);
    atrasCommand = new Command("AtrasBack", Command.BACK, 1);
    atrasCommand2 = new Command("Atras", Command.SCREEN, 1);
    //        txt =new TextBox("Estado","", 400, TextField.ANY);
    //        try {
    //    	    //Creamos el item del Form
    //    	    imagen= new ImageItem("", Image.createImage("/img/login.png"),
    // ImageItem.LAYOUT_CENTER, "Logo de Java");
    //
    //    	    append(imagen);
    //    	} catch (java.io.IOException e) {
    //    	    append(" Ha habido un problema al leer el fichero logo.gif\nMotivo:"+e);
    //    	}

    addCommand(exitCommand);
    addCommand(atrasCommand);
    addCommand(atrasCommand2);

    setCommandListener(this);
  }