2015-09-25 54 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