TabPaneDetacher: Make your tabs detachable

I though it would be cool to detach e.g. the pane to publish messages in MQTT.fx if needed by just dragging the tab and dropping it at the wanted position to open its content as a dedicated new window.

drag tab

The TabPaneDetacher provides an easy to use way to enable the detach capability of with any JavaFX TabPane instance just by calling:

public class TabPaneDetacherDemoController {

    @FXML
    private TabPane demoTabPane;
    
    @FXML
    public void initialize() {
        TabPaneDetacher.create().makeTabsDetachable(demoTabPane);
    }    
    
}

The tab is removed from the tab pane and a new window is created containing the content of the tab, the window title is set to the tab name value. On closing that window the tab is restored at the original position:

Code can be found here in my Bitbucket repo.

Leave a Reply to Harry Giannatos Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 thoughts on “TabPaneDetacher: Make your tabs detachable”