Package com.sun.lwuit

Examples of com.sun.lwuit.Container


   * Configure screen
   */
  public void configureFirstScreen() {
       
    //this.append(choice);
    Container cont = new Container();
    int elementWidth = 0;
    ButtonActionListener action = new ButtonActionListener(this);
   
    for (int i=0; i< Contents.gtwChoices.length; i++) {
      //TODO: add image
      Button b = new Button(Contents.gtwChoices[i] /*,img*/);
      b.getStyle().setBgTransparency(0);
      b.getStyle().setBorder(Border.createLineBorder(1));
      b.setAlignment(Label.CENTER);
      b.setTextPosition(Label.TOP);
     
          b.addActionListener(action);
          elementWidth = Math.max(b.getPreferredW(), elementWidth);
          cont.addComponent(b);
    }
    int cols = 2;//width / elementWidth;
      int rows = Contents.gtwChoices.length / cols;
      cont.setLayout(new GridLayout(rows, cols));
      this.addComponent(cont);
    //this.append(address);
    MyTextArea t = new MyTextArea(Contents.explainGtw);
    t.setEnabled(true);
    t.setFocusable(true);
View Full Code Here


        private Label focus = new Label("");
       
        public ContactsRenderer() {
            setLayout(new BorderLayout());
            addComponent(BorderLayout.WEST, pic);
            Container cnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
            name.getStyle().setBgTransparency(0);
            name.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM));
            name.getStyle().setFgColor(0xF1F57C);
            status.getStyle().setBgTransparency(0);
           
            display_width = Display.getInstance().getDisplayWidth();
            //location.getStyle().setFgColor(0xF1F57C); TODO cambiare colore
            pic.getStyle().setBgTransparency(0);
            cnt.addComponent(name);
            cnt.addComponent(status);
            addComponent(BorderLayout.CENTER, cnt);
            focus.getStyle().setBgTransparency(155);
            focus.getStyle().setBgColor(0xFF0000);
        }
View Full Code Here

      Dialog.show("New Message", Contents.new_convers + _conv.name, null, Dialog.TYPE_INFO,Datas.images.displayImage("message"), 3000);
      //display.setCurrent(new Alert("New Message", Contents.new_convers + _conv.name, Datas.images.displayImage("message"), info));
    }
    else {
      // send an alert
      midlet.tabbedPane.addTab(_conv.name, new Container());
          
            //midlet.getGuiConversation(midlet.tabbedPane.getSelectedIndex());
           
      //display.setCurrent(new Alert("New Message", Contents.new_convers + _conv.name, Datas.images.displayImage("message"), info));
      Dialog.show("New Message", Contents.new_convers + _conv.name, null, Dialog.TYPE_INFO,Datas.images.displayImage("message"), 3000);
View Full Code Here

  public void getGuiOfflineMenu() {

    offLineMenu = new Form(Contents.offline_form);
    offLineMenu.setLayout(new BorderLayout());
      //  int width = Display.getInstance().getDisplayWidth(); //get the display width
        Container mainContainer;
        int elementWidth = 0;

        mainContainer = new Container();
        //Image[] selectedImages = new Image[DEMOS.length];
        Image[] unselectedImages = new Image[4];
    
        //ButtonActionListener bAListner = new ButtonActionListener();
        //for (int i = 0; i < DEMOS.length; i++) {
        unselectedImages[0] = Contents.displayImage("connected");
        unselectedImages[1] = Contents.displayImage("settings");
        unselectedImages[2] = Contents.displayImage("unsubscribed");
        unselectedImages[3] = Contents.displayImage("choice");
          //  selectedImages[i] = temp;
        ButtonActionListener action = new ButtonActionListener();
        for (int i = 0; i < unselectedImages.length; i++) {
            Button b = new Button(Contents.offlineChoices[i], unselectedImages[i]);
           // b.setRolloverIcon(selectedImages[i]);
            b.setPressedIcon(unselectedImages[i].scaled( (int) (unselectedImages[i].getWidth()* 0.8),
                                             (int)(unselectedImages[i].getHeight() *0.8) ));
            b.getStyle().setBgTransparency(0);
            b.getStyle().setBorder(Border.createLineBorder(1));
            b.setAlignment(Label.CENTER);
            b.setTextPosition(Label.BOTTOM);
            mainContainer.addComponent(b);
            b.addActionListener(action);
          //  buttonpool.put(b, Contents.offlineChoices[i]);
            elementWidth = Math.max(b.getPreferredW(), elementWidth);
        }
           
        //Calculate the number of columns for the GridLayout according to the
        //screen width
        int cols = 2;//width / elementWidth;
        int rows = unselectedImages.length / cols;
        mainContainer.setLayout(new GridLayout(rows, cols));

        offLineMenu.addComponent(BorderLayout.CENTER, mainContainer);
   
   
    /*offLineMenu = new ChoiceGroup("OffLine", List.EXCLUSIVE, Contents.offlineChoices, null);
View Full Code Here

    tabbedPane.addTabsListener(listener);
    tabbedPane.getStyle().setBgTransparency(0);
       
        //}else
          //mainForm.removeAllCommands();
    Container contacts = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    contacts.getStyle().setBorder(Border.createEmpty());
    if (Datas.jid.status_message != null && !Datas.jid.status_message.equals("")){
      Label mood = new Label(Datas.jid.status_message);
      mood.getStyle().setBgTransparency(0);
      contacts.addComponent(mood);
    }
        /*ContactList*/ contacts_list = new ContactList();
        contacts_list.getStyle().setBgTransparency(0);
        contacts_list.getStyle().setBorder(Border.createEmpty());
        contacts_list.setListCellRenderer(new ContactsRenderer());
        contacts_list.setSmoothScrolling(true);
        //contacts_list.setFixedSelection(List.FIXED_LEAD); //da testare
        contacts_list.addActionListener(contacts_list);
        /*Image contacts = null;
        Image  persons[] = null;
    */
 
     
    String hide = (String)infopool.get("hide");
    if (hide.equals(Contents.hide[1]))
      roster = Datas.createOnlineRosterVector(true);
    else
      roster = Datas.createRosterVector(true);
    if (roster.size() > 0) {
      //contacts_list = new ChoiceGroup("Contacts", ChoiceGroup.EXCLUSIVE);
      for (int i=0;i< roster.size(); i++) {       
        Jid temp = (Jid)roster.elementAt(i);
        /*String username = temp.getUsername().replace('%', '@');
        contacts_list.append(username, Datas.images.displayImage(temp.getPresence()));*/
        contacts_list.addItem(temp);
      }
     
    }else if (hide.equals(Contents.hide[0]))
      contacts.addComponent(new Label(Contents.noRoster));
   
    Button b = new Button(hide);
    //TODO: cambiare lo style
    b.setAlignment(Label.CENTER);
    b.getStyle().setBgTransparency(100);
    b.getStyle().setBorder(Border.createEmpty());
    //b.getStyle().setBgSelectionColor(bgSelectionColor);
    //b.getStyle().setFgSelectionColor(fgSelectionColor);
    b.addActionListener(new ButtonActionListener());
    contacts.addComponent(b);
    contacts.addComponent(contacts_list);
    //contacts_list.append(hide, null);
    //contacts_list.setFont(contacts_list.size() - 1, Font.getFont(font.getFace(), Font.STYLE_ITALIC, font.getSize()));
   
    //valutare come trasformare questo


    /*StringItem choiceHide = new StringItem(hide, "", Item.HYPERLINK);
    choiceHide.addCommand(Contents.select);
    choiceHide.setItemCommandListener(this);   
    res.append(choiceHide);
    */ 
   
  /*  if (tabbedPane.getTabCount() > 0) {
      tabbedPane.removeTabAt(0);
      tabbedPane.insertTab("Contacts", null, contacts, 0);
    }else*/
    tabbedPane.addTab("Contacts", contacts);
      //PER IL MOMENTO RICOSTRUIsco MAINFORM TUTTE LE VOLTE
    if (Datas.conversations.size() > 0)
    {
   
      Vector chats = Datas.conversations;
     
      for (int k = 0; k < chats.size(); k++)
      {
        Conversation c = (Conversation)chats.elementAt(k);
        String name = c.name;
        if (name.indexOf("@") != -1) {
          name = name.substring(0, name.indexOf("@"));
        }
        tabbedPane.addTab(name, new Container());
      }

    }
    //tabbedPane.setSelectedIndex(0); 
    mainForm.addCommand(Contents.disc, 0);
View Full Code Here

     
    }
    else {
      options_form.setLayout(new BorderLayout());
          //int width = Display.getInstance().getDisplayWidth(); //get the display width
          Container mainContainer;
          int elementWidth = 0;

          mainContainer = new Container();
          //Image[] selectedImages = new Image[DEMOS.length];
          //Image[] unselectedImages = new Image[3];
         
      Image[] unselectedImages = new Image[] { Contents.displayImage("disconnected"), Contents.displayImage("add"), Contents.displayImage("msn"), Contents.displayImage("choice"), Contents.displayImage("presence"), Contents.displayImage("wake"), Contents.displayImage("message"), Contents.displayImage("invite") };
     
      ButtonActionListener action = new ButtonActionListener();
          for (int i = 0; i < unselectedImages.length; i++) {
              Button b = new Button(Contents.optionsChoices[i], unselectedImages[i]);
             // b.setRolloverIcon(selectedImages[i]);
              b.setPressedIcon(unselectedImages[i].scaled( (int) (unselectedImages[i].getWidth()* 0.8),
                                               (int)(unselectedImages[i].getHeight() *0.8) ));
              b.getStyle().setBgTransparency(0);
              b.getStyle().setBorder(Border.createLineBorder(1));
              b.setAlignment(Label.CENTER);
              b.setTextPosition(Label.BOTTOM);
              mainContainer.addComponent(b);
              b.addActionListener(action);
            //  buttonpool.put(b, Contents.offlineChoices[i]);
              elementWidth = Math.max(b.getPreferredW(), elementWidth);
          }
             
          //Calculate the number of columns for the GridLayout according to the
          //screen width
          int cols = 2;//width / elementWidth;
          int rows = unselectedImages.length / cols;
          mainContainer.setLayout(new GridLayout(rows, cols));

          options_form.addComponent(BorderLayout.CENTER, mainContainer);
     
     
          options_form.addCommand(Contents.ok);
View Full Code Here

        t.getStyle().setFgColor(0xF1F57C);
      conv_list.addComponent(t);
    }
   
    else state = "Group: "+ currentjid.group + " Status: "+currentjid.getPresence();
    Container info = new Container();
    info.setLayout(new GridLayout(1,2));
    info.getStyle().setBgTransparency(0);
      Label avatar = new Label(Jid.createAvatar(currentjid.getAvatar()).scaled(32, 32));
        avatar.getStyle().setBgTransparency(0);
    if (avatar.getWidth() < 32) {
      avatar.setPreferredSize(new Dimension(32,32));
     
    }
    info.addComponent(avatar);//AVATAR
    MyTextArea t = new MyTextArea(state, 0 ,100);
        t.setEnabled(true);
   
      t.getStyle().setFgColor(0xF1F57C);
    info.addComponent(t);
    conv_list.addComponent(info);
    //conv_list.setScrollable(false);
   
  /*
    Vector conversations = Datas.conversations;
View Full Code Here

      tabbedPane = new TabbedPane();
   
    tabbedPane.getStyle().setBgTransparency(0);
       
     
    conversationForm = new Container();
    conversationForm.setScrollableY(true);
    conversationForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    //conversationForm.getStyle().setBgColor()
    Vector msgs = currentConversation.messages;
    Message msg;
    //if (currentConversation.isMulti || canAnswer) {
    TextArea tf = new TextArea(2,100,TextArea.ANY); //settare stile
    tf.setFocus(true);
 
    //TextBox tf = new TextBox("", ">", 128, TextArea.ANY);
    infopool.put("text2send", tf);
    conversationForm.addComponent(tf);
   
    int maxText = 11; //max texts displayed
    if (history || msgs.size() < maxText)
      maxText = msgs.size();//all texts
   
    history = false; //reset
        //int lin = 0; //links count
    for (int i=msgs.size()-1; i>=msgs.size()-maxText; i--) {
      msg = (Message) msgs.elementAt(i);
      int j,p = -1;
          //TODO: mettere sfondo di colore alternato
      String m;
      if (currentConversation.isMulti)
        m = msg.getTextNick(); //cambiare
      else
        m = msg.getText(); //cambiare
      Container text = new Container(new BoxLayout(BoxLayout.X_AXIS));
     
      /*if (i%2 != 0) {
        text.getStyle().setBgTransparency(255);
       
      }*/
      text.getStyle().setBorder(Border.createEmpty()); //no border
      Label txt = new Label(m.substring(0, m.indexOf(">")+1));
      txt.getStyle().setFgColor(0xF1F57C);
      txt.getStyle().setBgTransparency(0);
      text.addComponent(txt);
      m = m.substring(m.indexOf(">")+1, m.length());
      if ((p = m.indexOf("1smile")) != -1) { //check smiles
        //conversationForm.addComponent(txt);
        if (p > 0) {
          text.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
          text.addComponent(new MyTextArea(m.substring(0, p),0,p));
        }
        Label l = new Label(Contents.displayImage(m.substring(p, p + 7)));
        l.getStyle().setBgTransparency(0);
        text.addComponent( l);
        if (p + 8 < m.length()-1)
          text.addComponent(new MyTextArea(m.substring(p + 8, m.length()),0,(m.length()-(p+8))));
     
      }
      if ((j = m.indexOf("+url+")) != -1) { //check links
        //conversationForm.addComponent(txt);
        //String name_link = "link";
          /*  if (lin == 0)
                  lin++;
            else {
                  name_link += lin;
                  lin++;
            }*/
        int k = m.indexOf("-url-");
        if (j > 0) {
          text.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
          text.addComponent(new MyTextArea(m.substring(0, j), 0,j));
        }
        j = j + 5;
        Button link = new Button(m.substring(j, k));
        link.getStyle().setBgTransparency(100);
        link.getStyle().setBorder(Border.createEmpty()); //no border
        link.addActionListener(new ButtonActionListener());
        text.addComponent(link); k = k + 5;
        if (k < m.length()-1)
          text.addComponent(new MyTextArea(m.substring(k, m.length()), 0, 100));
     

      }
      else if (j == -1 && p == -1) {
       
        MyTextArea t = new MyTextArea(m, 0,50);
        t.setEnabled(true);
        text.addComponent(t);
      }

           
      conversationForm.addComponent(text);
    }
   
    //if it is multi chat
    if (currentConversation.isMulti) {
      //conversationForm.append(new util.CustomSpacer(conversationForm.getWidth()));
    //  res.append("Room Members: ");
     
     
      Container multi = new Container();
      multi.setLayout(new BorderLayout());
      multi.addComponent(BorderLayout.NORTH,new MyLabel("Room Members:"));
     
      GroupChat chat = (GroupChat)Datas.multichat.get(currentConversation.name);
      //conversationForm.append(new util.CustomStringItem("Room Members:", /*chat.jids,*/ conversationForm.getWidth()));
      Container friends = new Container()
      for (int j=0; j<chat.jids.size(); j++){
       
        String temp = (String)chat.jids.elementAt(j);
        if (temp.equals(currentConversation.name))
          continue;
        else if (temp.indexOf('@') != -1)
          friends.addComponent(new Label(temp.substring(0, temp.indexOf('@'))));
        else
          friends.addComponent(new Label(temp));
      }
      multi.addComponent(BorderLayout.CENTER, friends);
      //conversationForm.append(new util.CustomSpacer(conversationForm.getWidth()));
      TextField tf1 = new TextField(Contents.invite_textbox, 64);
     
     
      infopool.put("invite", tf1);

      multi.addComponent(BorderLayout.SOUTH, tf1);
     
      conversationForm.addComponent(multi);
    }
   
    Button his = new Button("Show History");
    his.getStyle().setBgTransparency(100);
    his.getStyle().setBorder(Border.createEmpty());
    his.addActionListener(new ButtonActionListener());
    conversationForm.addComponent(his);
    //his.addCommand(Contents.history);
   
    //TODO: se mettessimo un tastino send sotto la textarea?
   
    if (currentConversation.isMulti)
      mainForm.addCommand(Contents.invite,2);
       
    tabbedPane.addTab("Contacts", new Container());
    if (tab == 0) { //nuova tab da aggiungere
            if (Datas.conversations.size() > 0)
            {

                Vector chats = Datas.conversations;

                for (int k = 0; k < chats.size()-1; k++)
                {
                    Conversation c = (Conversation)chats.elementAt(k);
                    String name = c.name;
                    if (name.indexOf("@") != -1) {
                        name = name.substring(0, name.indexOf("@"));
                    }
                    tabbedPane.addTab(name, new Container());
                }

            }
      //System.out.println("add tab:"+tab);
     
        listener.keypressed = false;
            String name = currentConversation.name;

            if (name.indexOf("@") != -1) {
                        name = name.substring(0, name.indexOf("@"));
            }
      tabbedPane.addTab(name, conversationForm);
      tabbedPane.setSelectedIndex(tabbedPane.getTabCount()-1);
      listener.keypressed = true;
    //  System.out.println("dopo add");
    }else {
      //System.out.println("insert tab:"+tab);
           
            if (Datas.conversations.size() > 0)
            {

                Vector chats = Datas.conversations;

                for (int k = 0; k < chats.size(); k++)
                {
                    Conversation c = (Conversation)chats.elementAt(k);
                    String name = c.name;
                    if (!name.equals(currentConversation.name)) {
                        if (name.indexOf("@") != -1) {
                            name = name.substring(0, name.indexOf("@"));
                        }
                        tabbedPane.addTab(name, new Container());
                    }else {
                        if (name.indexOf("@") != -1) {
                            name = name.substring(0, name.indexOf("@"));
                        }
                        tabbedPane.addTab(name, conversationForm);
View Full Code Here

          String m;
          if (currentConversation.isMulti)
            m = msg.getTextNick(); //cambiare
          else
            m = msg.getText(); //cambiare
          Container text = new Container(new BoxLayout(BoxLayout.X_AXIS));
         
      /*if (i%2 != 0) {
        text.getStyle().setBgTransparency(255);
       
      }*/
      text.getStyle().setBorder(Border.createEmpty());
          Label txt = new Label(m.substring(0, m.indexOf(">")+1));
          txt.getStyle().setFgColor(0xF1F57C);
          txt.getStyle().setBgTransparency(0);
          text.addComponent(txt);
          m = m.substring(m.indexOf(">")+1, m.length());
          if ((p = m.indexOf("1smile")) != -1) { //check smiles
          //  conversationForm.addComponent(txt);
            if (p > 0) {
              text.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
              text.addComponent(new MyTextArea(m.substring(0, p),0,p));
            }
            Label l = new Label(Contents.displayImage(m.substring(p, p + 7)));
            l.getStyle().setBgTransparency(0);
            text.addComponent( l);
            if (p + 8 < m.length()-1)
              text.addComponent(new MyTextArea(m.substring(p + 8, m.length()),0,(m.length()-(p+8))));
         
          }
          if ((j = m.indexOf("+url+")) != -1) { //check links
            //conversationForm.addComponent(txt);
            //String name_link = "link";
              /*  if (lin == 0)
                      lin++;
                else {
                      name_link += lin;
                      lin++;
                }*/
            text.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
            int k = m.indexOf("-url-");
            if (j > 0) {
              text.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
              text.addComponent(new MyTextArea(m.substring(0, j), 0,j));
            }
            j = j + 5;
            Button link = new Button(m.substring(j, k));
            link.getStyle().setBgTransparency(100);
            link.getStyle().setBorder(Border.createEmpty()); //no border
            link.addActionListener(new ButtonActionListener());
            text.addComponent(link); k = k + 5;
            if (k < m.length()-1)
              text.addComponent(new MyTextArea(m.substring(k, m.length()), 0, 100));
         

          }
          else if (j == -1 && p == -1) {
            //txt.setText(m);
            MyTextArea t = new MyTextArea(m, 0,50);
            t.setEnabled(true);
            text.addComponent(t);
          }
               
          conversationForm.addComponent(text);
        }
       
        //if it is multi chat
        if (currentConversation.isMulti) {
          //conversationForm.append(new util.CustomSpacer(conversationForm.getWidth()));
        //  res.append("Room Members: ");
         
         
          Container multi = new Container();
          multi.setLayout(new BorderLayout());
          multi.addComponent(BorderLayout.NORTH,new MyLabel("Room Members:"));
         
          GroupChat chat = (GroupChat)Datas.multichat.get(currentConversation.name);
          //conversationForm.append(new util.CustomStringItem("Room Members:", /*chat.jids,*/ conversationForm.getWidth()));
          Container friends = new Container()
          for (int j=0; j<chat.jids.size(); j++){
           
            String temp = (String)chat.jids.elementAt(j);
            if (temp.equals(currentConversation.name))
              continue;
            else if (temp.indexOf('@') != -1)
              friends.addComponent(new Label(temp.substring(0, temp.indexOf('@'))));
            else
              friends.addComponent(new Label(temp));
          }
          multi.addComponent(BorderLayout.CENTER, friends);
          //conversationForm.append(new util.CustomSpacer(conversationForm.getWidth()));
          TextField tf1 = new TextField(Contents.invite_textbox, 64);
          //mainForm.addCommand(Contents.invite);
View Full Code Here

    }catch(java.io.IOException e){
     logo = null;
    }  
     //Alert intro = new Alert("Jabber Mix Client", " Created by Gabriele Bianchi", logo, AlertType.INFO);
  
    Container body = new Container(new BorderLayout());
    //body.getStyle().setBgColor(0xFFFFFF,true);
    Label l =  new Label(logo);
    l.setAlignment(Label.CENTER);
    body.addComponent(BorderLayout.NORTH,l);
    MyTextArea t = new MyTextArea("Created by Gabriele Bianchi",0,100);
    //t.getStyle().setFgColor(0x0000FF,true);
    body.addComponent(BorderLayout.CENTER, t);
    Dialog.show("Jabber Mix Client", body, null, Dialog.TYPE_INFO, null, 3000);
   }
View Full Code Here

TOP

Related Classes of com.sun.lwuit.Container

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.