View Full Version : Two tab panel in a FormPanel

21 Oct 2011, 6:29 AM

In a FormPanel I included two TabPanles and gave activeTab as zero for both the panel but having problem to view first panel. How to activate zero tab on both the panels?

Thank You

8 Nov 2011, 2:32 PM
What specifically are you having problems with? I don't have any problems placing two TabPanels in a FormPanel.

In general, to select the first tab, use tabPanel.setSelection(tabPanel.getItem(0)). Here's a short code example I wrote to test for your problem.

public class TabPanelMan implements EntryPoint {

* Creates a tab item containing a single button. The item and the button are
* labelled with the provided integer.
* @param a The integer use in the label
* @return The constructed tab item
private static TabItem createTabItem(int a) {
TabItem item = new TabItem("Item " + a);
item.add(new Button("Button " + a));
return item;

public void onModuleLoad() {
// Create the form panel
FormPanel form = new FormPanel();

// Create the first tab panel and five tabs
final TabPanel tabPanelTop = new TabPanel();
for (int i = 0; i < 5; i++)

// Add it to the form

// Create the second tab panel and five tabs
TabPanel tabPanelBottom = new TabPanel();
for (int i = 5; i < 10; i++)

// Add it to the form

// Add the form to the page

// Also add a button that selects the first tab
RootPanel.get().add(new Button("Select Item 0", new SelectionListener<ButtonEvent>() {

public void componentSelected(ButtonEvent ce) {



If you're still having problems, post a short code sample showing what the problem is, or go into some more detail about what exactly isn't rendering properly.

8 Nov 2011, 3:23 PM
Not sure if this is related to your issue, but I found a quirk with tabs on a form; validation will not check tabs that have not been clicked on. This is due the default deferred rendering. To have validation check all tabs set deferredRender to false:

TabPanel tabs = new TabPanel();