JavaFX Draggable Tabs

The TabPane in JavaFX unfortunately does not provide mouse dragging / re-ording out of the box which is quite fustrating as users are now accustomed to doing that in their Browsers whey have Tabbed Browsing switched on.

There is a Jira Raised for this feature :

https://bugs.openjdk.java.net/browse/JDK-8092098

There Jira was targeted for Java 9, however Java 9 is now feature complete, so it’s likely Java 10 is the earliest we will see this being available.

Available Solutions

  1. https://github.com/sibvisions/javafx.DndTabPane

    This implementation draws a nice marker line as you drag the tabs around.

  2. http://berry120.blogspot.co.uk/2014/01/draggable-and-detachable-tabs-in-javafx.html
    This seems to be the simplest solution, its relatively easy to understand how it’s working (it works both Java 8 and Java 9-ea b158), in addition to the draggable tabs feature, it’s also detaching (tabs can be dragged out of the window into their own window).

    There is a few things you have to observe if you want to use it, as detailed in his blog.

  3. https://github.com/xylo/DraggableTabs

    There is this project which seems to based on similar solution to above, it’s more polished, has some sample code under tests, it’s also published onto maven central

Leave a Reply

Your email address will not be published.