How to repaint tab's label?

Hi!

I am trying to update labels of my tabsheet when user has changed the locale pressing the button. Nothing happens so could you pls help me how can I repaint the label?


t = new TabSheet();
tabLayout1 = new VerticalLayout();
tab1LabelB = new Label(getI18N().getMessage(“Tab1.label”));
initBasicInfoTab();
t.addTab(tabLayout1,tab1LabelB.toString(), basicInfoIcon);

Button enButton = new Button(“English”, new Button.ClickListener() {

		public void buttonClick(ClickEvent event) {
			getI18N().setCurrentLocale(Locale.ENGLISH);
			updateLabels();-------------->
		}
	});

private void updateLabels() {
selectLanguageLbl.setValue(getI18N().getMessage(“selectLanguage.label”));
tab1LabelB.setCaption(getI18N().getMessage(“Tab1.label”)); //Value has been changed, but label is still the old one???
tab1LabelB.setIcon(usersIcon);
t.requestRepaint();//Repainting the TabSheet

Thanks!
Sami

If I understand you correctly, you’re trying to use a Label as the caption in a TabSheet. But as the TabSheet API suggests, the caption is a normal Java String and cannot be bound to a data source such as a Label. The only way to update a tabs caption is using the TabSheet.getTab(Component) method to get the Tab, and calling Tab.setCaption(String) with the new caption. In your case that would be:

t.getTab(tabLayout1).setCaption(getI18N().getMessage("Tab1.label"))

Hi!

Thanks a lot! I was trying it too complicated I think!

Cheers/ Kiitos!
Sami