Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Form


  /* Create prompt alert. */
  public void run() {
    // Due to a quirk on T637 (MIDP 1.0), we need to create a form
    // before the alert or the alert will not be seen.
    Form formAlert = new Form(origCmd.getLabel());
    Image question = UiUtil.getImage("/icons/questionMk.png");
    formAlert.append(question);
    int ix = formAlert.append(new StringItem(null,
          (String)promptCommands.get(origCmd)));
    Command okCmd = UiUtil.getCmdRsc("cmd.ok", Command.OK, 1);
    formAlert.addCommand(okCmd);
    Command cancelCmd = UiUtil.getCmdRsc("cmd.cancel", Command.CANCEL, 2);
    formAlert.addCommand(cancelCmd);
    promptAlert = new Alert(origCmd.getLabel(),
        ((StringItem)formAlert.get(ix)).getText(), question,
        AlertType.CONFIRMATION);
    promptAlert.setTimeout(Alert.FOREVER);
    promptAlert.addCommand(okCmd);
    promptAlert.addCommand(cancelCmd);
    promptAlert.setCommandListener(this);
View Full Code Here


    private String localName;
    private int counter = 0;

    public ServerConection(BTMIDlet bTMIDlet) {
        this.bTMIDlet = bTMIDlet;
        form = new Form("Please wait");
        gauge = new Gauge("Waiting for players...", false, 100, 0);

        timer = new Timer();
        timer.schedule(this, 0, 10);
View Full Code Here

        main.startListening();
    }

    public void setHelp() {
       
        Form help = new Form("xUno ME - Help");
        StringItem helpText = new StringItem("xUNO ME",
                "This game is based on original UNO made by Mattel so it's not a"
                + " copy of UNO.\nThe game aim is to discard all cards first. "
                + "Each player starts with 7 cards and a random card from the "
                + "deck is put on the table. In your turn, the player just can "
                + "discard a card if it has some card with same color, same number, "
                + "or same type of table card or wild draw four, and wild. "
                + "When the player has one card, the player is compulsory to \"call xUno\""
                + "or it will be penalized with 3 cards.\n\n");
        help.append(helpText);

        StringItem commands = new StringItem("Keyboard Commands:",
                "Left or 4: Move the selection to left.\n" +
                "Right or 6: Move the selection to right.\n" +
                "Fire or 5: Discard the selected card if possible.\n" +
                "0: Calls xUno when the player has 1 card.\n" +
                "5: Get a card from de deck if the player doesn't have a possible move.\n" +
                "1,3,7,9: Choose, respectively, the colors blue, green, red and yellow.\n" +
                "*: Back to main menu."
                );
        help.append(commands);

        StringItem aboutTouchCommands = new StringItem("Touchscreen Commands:",
                "Click in card to try discard it.\n"
                + "Click in deck to get one card.\n"
                + "Click in middle of discarded cards to call xUno.\n"
                + "Click in colored square to choose color."
                );
        help.append(aboutTouchCommands);

        help.addCommand(new Command("Back", Command.BACK, 0));
        help.setCommandListener(this);
        lcd.setCurrent(help);
    }
View Full Code Here

    public static void showMessage(final String message, final Exception ex) {
        showMessage("Error", message, ex);
    }

    protected static void showMessage(final String header, final String message, final Exception ex) {
        Form f = new Form(header);
        f.addCommand(new Command("OK", Command.OK, 0));
        if (ex != null) {
            f.append(message + ": " + ex.getMessage());
        } else {
            f.append(message);
        }

        f.setCommandListener(new Listener(Main.display.getCurrent()));
        Main.display.setCurrent(f);
    }
View Full Code Here

  public Display display = Display.getDisplay(this);

  protected static Command cmdExit = new Command("Exit", Command.SCREEN, 5);

  protected void startApp() throws MIDletStateChangeException {
    Form f = new Form("Info");
    f.addCommand(cmdExit);

    Calendar calLocal = Calendar.getInstance();
    // calLocal.setTimeZone(TimeZone.getTimeZone("PST"));
    Calendar calUTC = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
    // calUTC.setTimeZone();

    f.append("Local time: " + calLocal.getTimeZone().getRawOffset() + "\n");
    f.append("UTC time: " + calUTC.getTimeZone().getRawOffset() + "\n");

    String tz[] = TimeZone.getAvailableIDs();
    for (int i = 0; i < tz.length; i++) {
      f.append(tz[i] + "\n");
    }
   
    Canvas s=new Canvas() {
      protected void paint(Graphics arg0) {
        // TODO Auto-generated method stub
       
      }
    };
    f.append("width="+s.getWidth());
    f.append("h="+s.getHeight());

    /*try {
      EventList events = (EventList) PIM.getInstance().openPIMList(
          PIM.EVENT_LIST, PIM.READ_WRITE);
      if (events.maxCategories() != 0) {
        events.addCategory("TV");
            }
     
      calLocal.set(Calendar.MILLISECOND,0);
      calLocal.set(Calendar.SECOND,0);
      calLocal.set(Calendar.MINUTE,1);
      calLocal.set(Calendar.HOUR_OF_DAY,23);
      cr(events, calLocal.getTime(),"LOCAL");
      calUTC.set(Calendar.MILLISECOND,0);
      calUTC.set(Calendar.SECOND,0);
      calUTC.set(Calendar.MINUTE,2);
      calUTC.set(Calendar.HOUR_OF_DAY,23);
      cr(events, calUTC.getTime(),"UTC");
      
    } catch (Exception ex) {
      ex.printStackTrace();
    }*/

    /*
     * Enumeration rootEnum = FileSystemRegistry.listRoots(); while
     * (rootEnum.hasMoreElements()) { Object root = rootEnum.nextElement();
     * f.append("class="+root.getClass().getName()+"\n");
     * f.append(root.toString()+"\n"); }
     */

    /*
     * String uri = "file:///" + "C:/"; f.append("open '" + uri + "'"); try {
     * FileConnection fc = (FileConnection) Connector.open(uri); f.append(" -
     * ok\n"); } catch (Exception ex) { f.append(" - error:" +
     * ex.getMessage()+"\n"); } uri = "file:///" + "Phone memory/";
     * f.append("open '" + uri + "'"); try { FileConnection fc =
     * (FileConnection) Connector.open(uri); f.append(" - ok\n"); } catch
     * (Exception ex) { f.append(" - error:" + ex.getMessage()+"\n"); }
     */

    f.setCommandListener(this);
    display.setCurrent(f);
  }
 
View Full Code Here

        this.mid = mid;
        this.name = nome;
        out = outForm;
        stopAtFirst = stop;
        serversForm = new Form("xUno ME - Bluetooth");
        serversForm.append(new StringItem("Opening bluetooth.", ""));
        mid.getLCD().setCurrent(serversForm);
    }
View Full Code Here

       
        msgs = new Vector();

        msg = new TextField("Message:", "", 40, TextField.ANY);

        chatForm = new Form("xUNO ME");
        chatForm.append(msg);
        chatForm.setCommandListener(this);
        chatForm.addCommand(sendMsg);
        chatForm.addCommand(back);
        mid.getLCD().setCurrent(chatForm);
View Full Code Here

  {
    ASAP_ModuleInfo module_info = asap.getModuleInfo();
    int duration = module_info.durations[song];

    gauge = new Gauge(null, false, 1, 0);
    Form playForm = new Form("ASAP " + ASAP.VERSION);
    appendStringItem(playForm, "Name: ", module_info.name);
    appendStringItem(playForm, "Author: ", module_info.author);
    appendStringItem(playForm, "Date: ", module_info.date);
    appendStringItem(playForm, "Time: ", ASAP.durationToString(duration));
    playForm.append(gauge);
    playForm.addCommand(stopCommand);
    playForm.addCommand(exitCommand);
    playForm.setCommandListener(this);
    Display.getDisplay(this).setCurrent(playForm);

    if (duration < 0)
      duration = 180000;
    gauge.setMaxValue(duration);
View Full Code Here

        cmdDestroy = new Command("Destroy", Command.EXIT, 0);
        cmdPause = new Command("Pause", Command.STOP, 0);
        cmdHide = new Command("Hide", Command.SCREEN, 0);
        cmdMgr = new Command("Show Manager", Command.SCREEN, 0);
       
        form = new Form(name + " screen");
       
        form.addCommand(cmdMgr);
        form.addCommand(cmdHide);
        form.addCommand(cmdPause);
        form.addCommand(cmdDestroy);
View Full Code Here

                    Command.SCREEN, 0);
        }
        cmdI3Framework = new Command("Start I3 Nams Framework",
                Command.SCREEN, 0);

        form = new Form("NAMS Manager screen");

        form.addCommand(cmdRefresh);
        form.addCommand(cmdExit);
        form.addCommand(cmdHide);
        for (i = 0; i < 3; ++i) {
View Full Code Here

TOP

Related Classes of javax.microedition.lcdui.Form

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.