2013-03-07 37 views
-1

我需要從一個字符串列表中創建一個動態列表,並使用List-items作爲MenuItem條目。這可能就像一個循環在整個列表,然後GWT動態MenuItem列表

new MenuItem(list-entry, new Command(){}) 

之後,我要選擇它像一個複選框(只是使用不是實際的複選框)。 我的思維進展合理嗎?還是我需要重新思考一切?感謝您的幫助,謝謝:)

回答

1

是的,你可以在上面

MenuBar mymenubar = new MenuBar(true); 
      for(final String string : myListOfStrings){ 

       MenuItem menuItem = new MenuItem(string , new Command() { 
        @Override 
        public void execute() { 
         //Do some thing on each menu 
        } 
       }); 

       mymenubar .addItem(menuItem); 
      } 

選擇像一個複選框(在菜單項)循環不是你只能選擇一個菜單項的好idea.In菜單一次。

+0

好的thx。我只想選擇一個。 – vicR 2013-03-08 10:58:17