Package com.sun.lwuit

Examples of com.sun.lwuit.Button


        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;
View Full Code Here


    //return res;
  }
 
  public void commandActionOfflineMenu(Command id) {
    if (id == Contents.ok) {
      Button b = (Button)offLineMenu.getFocused();
      if (b.getText().equals(Contents.offlineChoices[0])) {
        if (Datas.noData) { //conf data set ?
          internal_state = PARAMS;
          Dialog.show("", Contents.noData, null, Dialog.TYPE_WARNING, null, 3000);
          getGuiParams();
        }else {
          getGuiWaitConnect();
          internal_state = WAIT_CONNECT;
          if (Datas.isHTTP)
            cm.httpConnect(); //HTTP
          else
            cm.connect(0); //TCP
        }
      }
       
      else if (b.getText().equals(Contents.offlineChoices[1])) {
        getGuiParams();
        internal_state = PARAMS;
      }
    /*  else if (offLineMenu.getSelectedIndex() == 2)
      {
        display.setCurrent(new WSForm(this));
        internal_state = OFFLINE;
      }*/
      else if (b.getText().equals(Contents.offlineChoices[2])) {
       
       
        Dialog.show("Help", Contents.help, "Ok", "");
        getGuiOfflineMenu();
        internal_state = OFFLINE;
      }
      else if (b.getText().equals(Contents.offlineChoices[3])) {
       
       
        Dialog.show("Credits", Contents.credits, "Ok", "");
        getGuiOfflineMenu();
        //internal_state = OFFLINE;
View Full Code Here

      }
     
    }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()));
   
View Full Code Here

    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));
View Full Code Here

      midlet.getGuiOtherOptions();

    }
    else if (cmd == Contents.select)
    {
      Button b;
      try {
        b = (Button)this.getFocused();
      } catch (Exception e) {
        // TODO Auto-generated catch block
        return;
      }
     
      String t = b.getText();
          if (t.equals(Contents.gtwChoices[0])) { //MSN
        this.configureRegistration(existTransport(services,"msn"));
      }else if (t.equals(Contents.gtwChoices[1])) {
        this.configureRegistration(existTransport(services,"aim"));
      }else if (t.equals(Contents.gtwChoices[2])) {
View Full Code Here

    private GatewayForm form;
    public ButtonActionListener(GatewayForm f) {
      form = f;
    }
        public void actionPerformed(ActionEvent evt) {
          Button b = (Button)evt.getSource();
          String t = b.getText();
          if (t.equals(Contents.gtwChoices[0])) { //MSN
        form.configureRegistration(existTransport(services,"msn"));
      }else if (t.equals(Contents.gtwChoices[1])) {
        form.configureRegistration(existTransport(services,"aim"));
      }else if (t.equals(Contents.gtwChoices[2])) {
View Full Code Here

    return (false);
  }
 
  private class ButtonActionListener implements ActionListener {
        public void actionPerformed(ActionEvent evt) {
          Button b = (Button)evt.getSource();
          switch (internal_state) {
            case OFFLINE:
              commandActionOfflineMenu(Contents.ok);
              break;
            case ONLINE:
              //commandActionOnlineMenu(Contents.ok);
              String hide = (String)infopool.get("hide");
            if (hide.equals(Contents.hide[1]))
              infopool.put("hide", Contents.hide[0]);
            else
              infopool.put("hide", Contents.hide[1]);
            getGuiOnlineMenu();
              break;
            case ROSTER:
              commandActionRoster(Contents.ok);
              break;
            case OPTIONS:
              commandActionOtherOptions(Contents.ok);
              break;
            case STATUS:
              commandActionChangeStatus(Contents.ok);
              break
            case JUD:
              commandActionJud(Contents.ok);
              break;
            case CONVERSATION:
             
              if (b.getText().indexOf("History") != -1)
                commandActionConversation(Contents.history);
              else
                commandActionConversation(new Command(b.getText())); //link address
              break;
           
           
             
          }
View Full Code Here

         
      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;
View Full Code Here

      display.setCurrent(getGuiConversation());
      internal_state = CONVERSATION;
      System.gc();//garbage!!
    }*/
    else {
      Button b = (Button)options_form.getFocused();
      String text = b.getText();
      if (text.equals(Contents.optionsChoices[0])) {
        // disconnecting...
    //in offline mode, all chats are deleted
        Datas.multichat.clear();
        Datas.conversations.removeAllElements();
View Full Code Here

    }*/
    //TODO: valutare la possibilit� di mettere i bottoni come offlinemenu
    ButtonActionListener action = new ButtonActionListener();
       
    for (int k=0; k<Contents.rosterChoices.length; k++) {
          Button b = new Button(Contents.rosterChoices[k]);
            b.getStyle().setBgTransparency(100);
            b.getStyle().setBorder(Border.createEmpty());
            b.addActionListener(action);
            conv_list.addComponent(b);
        }
       
    if (Presence.getPresence("unsubscribed").equals(currentjid.getPresence())){
      Button b = new Button(Contents.online_choices[1]);
            b.getStyle().setBgTransparency(100);
            b.getStyle().setBorder(Border.createEmpty());
            b.addActionListener(action);
            conv_list.addComponent(b);
      //conv_list.append(Contents.online_choices[1], null);//try to subscribe
      //conv_list.setFont(conv_list.size() - 1, Font.getFont(font.getFace(), Font.STYLE_BOLD, font.getSize()));
    }
    else if (Presence.getPresence("unavailable").equals(currentjid.getPresence())) {
      //wake-up with SMS
      Button b = new Button(Contents.online_choices[2]);
            b.getStyle().setBgTransparency(100);
            b.getStyle().setBorder(Border.createEmpty());
            b.addActionListener(action);
            conv_list.addComponent(b);
    }

    //res.append(conv_list);
    //res.append(new util.CustomSpacer(res.getWidth(), res.getHeight()));
View Full Code Here

TOP

Related Classes of com.sun.lwuit.Button

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.