1

What is the best way to add a grid to a tabpanel for gwt?

Thanks!

1 Answers1

0

TabPanel has two methods that

  • void add(Widget w, String tabText) // Adds a widget to the tab panel.

  • void add(Widget w, String tabText, boolean asHTML) //Adds a widget to the tab panel.

With these methods you can add any widget to the tabpanel. Grid is also widget. So,

    TabPanel tabPanel = new TabPanel();

    Grid grid = new Grid(1, 1);
    tabPanel.add(grid, "firstTab", false);
    grid.setSize("5cm", "3cm");

    RootPanel.get().add(tabPanel);
  • Thanks hilal! Is this the only way to do this? Instead of adding the grid to the panel in java, is it possible to do this in the xml? – stealthfighter Dec 30 '10 at 01:14
  • what do you mean by xml ? module ? then you can't you can do it with uibinder. have a look at this http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html –  Dec 30 '10 at 05:00
  • Thank you! It would be nice if there is an existing example project for that. – stealthfighter Dec 30 '10 at 08:15