Yes, the selection reverts to -1 if you remove the selected tab. It is up to
your app to decide how to deal with that case.
G
On May 7, 2011, at 4:23 AM, Edvin Syse wrote:
> When I close a tab in a TabPane, the TabPane-content area is left empty. I
> added a listener to deal with this like so:
>
> tabs.getTabPaneListeners().add(new TabPaneListener.Adapter() {
> public void tabsRemoved(TabPane tabPane, int index,
> Sequence<Component> tabs) {
> if (tabPane.getTabs().getLength() > 0) {
> int leftOfClosedTabIndex = Math.max(0, index - 1);
> tabPane.setSelectedIndex(leftOfClosedTabIndex);
> }
> }
> });
>
> Is it correct that there is no such functionality or policies to choose from
> in the framework? I'm not saying it's a bad thing though :)
>
> -- Edvin