adding tabs at runtime

I am creating an application which requires tabs to be added at runtime to a phab application.also the previous tabs which were there should be present when the new tabs are to be added.The previous ones shouldnt get deleted. How can it be done? Read about PtPanelGroup but coudnt get much .Plz someone help with some sample code.