int selectedIndex = tabPane.getSelectedIndex();
if (selectedIndex != previousSelectedIndex) {
// This was not an indirect selection change
if (selectedIndex == -1) {
Button button = tabButtonGroup.getSelection();
if (button != null) {
button.setSelected(false);
}
} else {
final Button button = (Button)tabButtonBoxPane.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) {