}
} else {
final Button button = (Button)buttonBoxPane.get(selectedIndex);
button.setSelected(true);
Component selectedTab = tabPane.getTabs().get(selectedIndex);
selectedTab.setVisible(true);
selectedTab.requestFocus();
ApplicationContext.queueCallback(new Runnable(){
@Override
public void run() {
button.scrollAreaToVisible(0, 0, button.getWidth(), button.getHeight());
}
});
}
if (previousSelectedIndex != -1) {
Component previousSelectedTab = tabPane.getTabs().get(previousSelectedIndex);
previousSelectedTab.setVisible(false);
}
if (selectedIndex == -1
|| previousSelectedIndex == -1) {
invalidateComponent();