View Full Version : How to add TabItems to a TabPanel from an other class?

3 Sep 2009, 7:23 AM
I have the following class which contains a TabPanel:

public class MyTabPanel extends Composite {
private TabPanel tabPanel = new TabPanel();

public MyTabPanel() {



public void addTabItem(TabItem item) {
Now i want to add from an other widget a TabItem to the TabPanel. I use a Button like this:

public class MenuWidget extends ContentPanel {
Button addNewTab = new Button("Add Tab");
SelectionListener<ButtonEvent> sel;
sel = new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {

// Here should be called MyTabPanel.add(item)
// but how?
Any idea how to create a reference from MenuWidget to MyTabPanel ?