Package com.sun.lwuit

Examples of com.sun.lwuit.Form


  /**
   * Show the form to insert user jid information
   * @return
   */
  public void getGuiParams() {
    Form res = new Form(Contents.settings_form);
    res.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
   
    /*String subdomain = "";
    if (Datas.subdomain != null)
      subdomain = "@"+Datas.subdomain;
      */
    TextArea jid = new TextArea(Datas.jid.getUsername(), 32);
    TextArea server = new TextArea(Datas.server_name, 64);
    TextArea subdomain = new TextArea(Datas.subdomain, 64);
   
    TextArea password = new TextArea(Datas.getPassword(), 1,32, TextArea.PASSWORD);
    TextArea mail = new TextArea(Datas.jid.getMail(), 1,32, TextArea.EMAILADDR);
    TextArea port = new TextArea(Datas.customPort, 1,5, TextArea.NUMERIC);
    infopool.put("password", password);
   
   
    infopool.put("jid", jid);
    infopool.put("mail", mail);
    infopool.put("server", server);
    infopool.put("subdomain", subdomain);
    infopool.put("port", port);
    res.addComponent(new MyLabel("Username *"));
    res.addComponent(jid);
    res.addComponent(new MyLabel("Password *"));
    res.addComponent(password);
    res.addComponent(new MyLabel("Mail"));
    res.addComponent(mail);
    res.addComponent(new MyLabel("Jabber domain"));
    res.addComponent(subdomain);
    res.addComponent(new MyLabel("Server address *"));
    res.addComponent(server);
    res.addComponent(new MyLabel("Port"));
    res.addComponent(port);
    res.addComponent(new MyLabel("Connection type"));
    ssl_list = new ButtonGroup();
    for (int k = 0; k < Contents.sslChoices.length; k++) {
      RadioButton rb = new RadioButton(Contents.sslChoices[k]);
      Style s = rb.getStyle();
          s.setMargin(0, 0, 0, 0);
          s.setBgTransparency(0);
          ssl_list.add(rb);
          res.addComponent(rb);
    }
   
    if (Datas.isSSL)
      ssl_list.setSelected(1);
    else if (Datas.isHTTP)
      ssl_list.setSelected(2);
    else
      ssl_list.setSelected(0);
   
    res.addComponent(new MyLabel("Your Avatar"));
    avatar_list = new ButtonGroup(); //choose AVATAR
    String[] img = new String [] {"icon", "jmcAvatar"}; //spostare in contents
    for (int k = 0; k < 2; k++) {
      RadioButton rb = new RadioButton("avatar "+(k+1), Contents.displayImage(img[k]).scaled(16, 16));
      Style s = rb.getStyle();
          s.setMargin(0, 0, 0, 0);
          s.setBgTransparency(0);
          avatar_list.add(rb);
          res.addComponent(rb);
    }
   
    if (Datas.avatarFile != null && Datas.avatarFile.indexOf("icon") == -1)
      avatar_list.setSelected(1);
    else if (Datas.avatarFile != null)
      avatar_list.setSelected(0);
   
   
    Label m = new Label("* Mandatory fields");
    m.getStyle().setBgTransparency(0);
    m.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_SMALL));
    m.setEnabled(true);
    m.setFocusable(true);
    res.addComponent(m);
    res.addCommand(Contents.back);
    res.addCommand(Contents.ok);
    res.setCommandListener(this);
   
    res.show();
  }
View Full Code Here


  /**
   * Wait for connecting
   * @return
   */
  public void getGuiWaitConnect() {
    Form wait_form = new Form(Contents.wait_form);
    wait_form.setLayout(new BorderLayout());
    //if (wait_form == null) {
   
   
      wait_form.addComponent(BorderLayout.CENTER,new MyLabel("Please wait...."));
    /*  Progress p2;
      try {
        p2 = new Progress(Image.createImage("/unfilled.png"), Image.createImage("/filled.png"));
        p2.getStyle().setBgTransparency(0);
        wait_form.addComponent(BorderLayout.CENTER, p2);
      } catch (IOException e) {
       
       
      }*/
      wait_form.addCommand(Contents.back);
      wait_form.setCommandListener(this);
      //TODO: mettere gauge
    //}
    wait_form.show();
  }
View Full Code Here

   * @return Form
   */
  public void getGuiChoose(String type) {
   
    String text = "";
    Form subscriber = null;
    if (type.equalsIgnoreCase("subscription")) {
      subscriber = new Form(Contents.subsc_form);
      subscriber.setLayout(new BorderLayout());
      text = currentjid.getUsername()+ " wants to subscribe your presence!";
    }
    else if (type.equalsIgnoreCase("invitation")) {
      subscriber = new Form(Contents.invit_form);
      text = "You have been invited to " + (String)infopool.get("invit_room") + " from "+(String)infopool.get("invit_from");
    }
    subscriber.setLayout(new BorderLayout());
    MyTextArea t = new MyTextArea(text, 0, 100);
   
    subscriber.addComponent(BorderLayout.CENTER,t);
   
    subscriber.addCommand(Contents.accept);
    subscriber.addCommand(Contents.deny);
    subscriber.setCommandListener(this);
    subscriber.show();
  }
View Full Code Here

  /**
   *Display existing conversations and the form to join in a new chat room
   * @return
   */
  public void getGuiRoomList() {
    Form rooms = new Form("Chat Rooms");
        rooms.setLayout(new BorderLayout());
       // rooms.setScrollable(false);
        Container cont = new Container();
        cont.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    //show existing chats
    //openrooms = new ChoiceGroup("Your Active Chats", ChoiceGroup.EXCLUSIVE);
    //if (infopool.remove("newchat") != null) {
        TextField nick = new TextField(Datas.jid.getUsername(), 32);
        TextField room = new TextField(/*"Chat Room", */"", 32);
        TextField server = new TextField(/*"Chat Server",*/ "conference."+Datas.hostname, 32);
    cont.addComponent(new MyLabel("Your Nick"));
    cont.addComponent(nick);
    cont.addComponent(new MyLabel("Chat Room"));
    cont.addComponent(room);
    cont.addComponent(new MyLabel("Chat Server"));
    cont.addComponent(server);
    cont.addComponent(new MyLabel("Discover Rooms?"));
    yesno = new ButtonGroup(/*"Discover Rooms?", ChoiceGroup.EXCLUSIVE*/);
    RadioButton rb = new RadioButton("No");
    Style s = rb.getStyle();
        s.setMargin(0, 0, 0, 0);
        s.setBgTransparency(70);
        RadioButton rb1 = new RadioButton("Yes");
    Style s1 = rb1.getStyle();
        s1.setMargin(0, 0, 0, 0);
        s1.setBgTransparency(70);
        cont.addComponent(rb);
        cont.addComponent(rb1);
        yesno.add(rb);
        yesno.add(rb1);
        yesno.setSelected(0);
   
    infopool.put("nick", nick);
    infopool.put("room", room);
    infopool.put("chatserver", server);
  //  }
/*
    else { //TODO: unificare nella gestione delle chat aperte quindi in onlinemnu
      Enumeration chats = Datas.multichat.keys();
      while (chats.hasMoreElements()){
        String temp = (String)chats.nextElement();
     
        openrooms.append(temp, null);
      }
      openrooms.append("Create/Join new chat", null);
     
      rooms.append(openrooms);
      if (Datas.rooms != null){ //rooms discovery
        //spacer?
        rooms.append(new util.CustomSpacer(rooms.getWidth()));

        rooms.append(new util.CustomStringItem("Existing rooms:", Datas.rooms, rooms.getWidth()));
        //rooms.append("Existing rooms:");
        //for(int k=0;k<Datas.rooms.size();k++)
        //  rooms.append((String)Datas.rooms.elementAt(k));
      }
      else
        rooms.append(new util.CustomSpacer(rooms.getWidth(), rooms.getHeight()));
    }
   
  */  rooms.addComponent(BorderLayout.CENTER, cont);
    rooms.addCommand(Contents.back);
    rooms.addCommand(Contents.ok);
    rooms.setCommandListener(this);
    rooms.show();
  }
View Full Code Here

TOP

Related Classes of com.sun.lwuit.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.