I\'m working on example from this tutorial. Based on the tutorial I want to drag tabs between two tabs. So far I managed to create this code but I need some help in order to
Thank you very much for this, it works basically well. However, when dragging to the first / upper tabpane from the second one, the content of the tab does not get refreshed, you need to change the tab or move the split divider. The second / lower tabpane does always refresh correctly. I have not found a remedy for this so far, asking the tabpane to do a refresh does not work. I would really appreciated if I could find a solution for this.
Edit: found a working solution
In the setOnDragDropped event handler I commented the line that selects the added tab, then added the following code:
Platform.runLater(new Runnable() {
@Override
public void run() {
tabPane.getSelectionModel().select(tab) ;
}
});
now it works. Thanks again
Edit 2: I'm sorry that I have to report that it works sometimes / most of the time, but not always.. still investigating on how to fix it for real.
Edit 3: At least now i know what causes the problem: when one tab is removed and added to the other pane, the removal from the old tabpane is not instant, and then the old pane disable the update of the context of that tab which is now already in the other tabpane. that's why it does not get drawn at all. When I put a Thread.sleep(500) (shorter sleep time is not working) between the calls to remove and add, everything works fine. Will update later if I manage to find a solution.