2015-09-25 31 views
0

我想知道如何動態改變形式的搜索後後動態地改變一種形式,我有:如何搜索CodenameOne

被點擊的多鍵bbb2
Form hi = new Form("Soggetti"); 
     BoxLayout b=new BoxLayout(BoxLayout.Y_AXIS); 
     TableLayout ttt=new TableLayout(10,1); 
     int ttt_height=20; 
     ttt.setDefaultRowHeight(ttt_height); 
     ttt.setDefaultColumnWidth(100); 
     hi.setLayout(ttt); 
MultiButton bbb=new MultiButton(); 
     bbb.setTextLine1("Soggetto 1"); 
     bbb.setTextLine2("Dettagli "); 
     bbb.setIcon(i); 
     bbb.setEmblem(s); 

     MultiButton bbb2=new MultiButton(); 
     bbb2.setTextLine1("Soggetto 1"); 
     bbb2.setTextLine2("Dettagli "); 
     bbb2.setIcon(i); 
     bbb2.setEmblem(s); 
     MultiButton bbb3=new MultiButton(); 
     bbb3.setTextLine1("Soggetto 1"); 
     bbb3.setTextLine2("Dettagli "); 
     bbb3.setIcon(i); 
     bbb3.setEmblem(s); 

bbb2.addActionListener(new ActionListener(){ 
      @Override 
      public void actionPerformed(ActionEvent evt) { 
       int p=1; 
       p++; 
       // TODO Auto-generated method stub 
      // bbb3.setVisible(true); 
       hi.removeAll(); 
       //hi = new Form("Soggetti"); 

       BoxLayout b=new BoxLayout(BoxLayout.Y_AXIS); 

       TableLayout ttt=new TableLayout(10,1); 
       int ttt_height=5; 
       ttt.setDefaultRowHeight(ttt_height); 
       ttt.setDefaultColumnWidth(100); 
       hi.setLayout(ttt); 
       //ci ricreiamo i i bottoni precedenti 
       hi.addComponent(bbb); 
       hi.addComponent(bbb2); 

       ArrayList<LinkedHashMap> alhm= Ricerca(""); 
       Label contatto=null; 
       for(int j=0;j<alhm.size();j++){ 
        LinkedHashMap s=alhm.get(j); 
        String nome=(String) s.get("firstName"); 
        String cognome=(String) s.get("lastName"); 
        String numero =(String) s.get("numero"); 
        contatto=new Label(nome+" "+cognome+" "+numero); 

        Double id= (Double) s.get("id"); 
        hi.addComponent(contatto); 
       } 

       hi.addComponent(bbb3); 

      // SchermataRubrica sr=new SchermataRubrica(); 
      // sr.getSchermata(); 
       hi.show(); 
      } 

     }); 

     hi.addComponent(bbb); 
     hi.addComponent(bbb2); 
     hi.addComponent(bbb3); 

     hi.addCommand(Schermata1); 
     hi.addCommand(Schermata2); 
     hi.addCommand(Schermata3); 

     hi.show(); 

當我要出現如下結果那多鍵而是它搞砸了一切可能......我失去了一些東西在邏輯電平... 謝謝

回答

0

更換hi.show()hi.revalidate()結果。

我可能不會使用TableLayout搜索結果,並會選擇BoxLayout。見我們就地搜索在這裏,它可能不正是你所需要的,但應該給你一個提示:https://www.codenameone.com/blog/building-a-chat-app-with-codename-one-part-4.html

您也可以動畫去除/添加成分而很好地與animateUnlayoutanimateLayout

+0

謝謝謝,我會試試,我想感謝你給我的所有答案和提示......你arr真棒 – Lorenzo