code: private void setCurrentTab(final int index)
  	{
  		if (this.currentTab == index)
  		{
  			// already current
  			return;
  		}
  		this.currentTab = index;
  
  		final Component component;
  
  		if ((currentTab == -1) || tabs.isEmpty() || !getVisiblityCache().isVisible(currentTab))
  		{
  			// no tabs or the current tab is not visible
  			component = newPanel();
  		}
  		else
  		{
  			// show panel from selected tab
  			final T tab = tabs.get(currentTab);
  			component = tab.getPanel(TAB_PANEL_ID);
  			if (component == null)
  			{
  				throw new WicketRuntimeException("ITab.getPanel() returned null. TabbedPanel ["
  					+ getPath() + "] ITab index [" + currentTab + "]");
  			}
  		}
  
  		if (!component.getId().equals(TAB_PANEL_ID))
  		{
  			throw new WicketRuntimeException(
  				"ITab.getPanel() returned a panel with invalid id [" + component.getId()
  					+ "]. You always have to return a panel with id equal to the provided panelId parameter. TabbedPanel ["
  					+ getPath() + "] ITab index [" + currentTab + "]");
  		}
  
  		addOrReplace(component);
  	}
docs: Sets the current tab.
  
  @param index
  the new current tab