TabSheet bug ?

A strange behavior :


TabSheet selector = new TabSheet();
selector.addTab ( new Button("123"), "Tab 1", null );

Results in button’s caption set to “Tab 1” , not “123” … is this ok ?

Hi!

TabSheet uses contained components caption in its tabs. So


addTab ( Component c,  String s , Icon c );

is actually just a helper function that does:


tabsheet.addComponent(c);
c.setCaption(s);
c.setIcon(c);

That system works pretty well in most cases as one most often has a layout or a component that does not “internally” use its caption in each tab.

We’ll concentrate to improve our documentation during this week, so I’ll keep in mind that the javadoc needs some explanation.

cheers,
matti

Matti, thanks for the clarification. Yep, this is a bit confusing, so some extra details in the manual would be fine.

P.S. In my case I tried to add a Panel with light style into the tabsheet tab, in order to benefint from the panel’s nice caption, that’s how I was caught on this :slight_smile: