Upon public request I’ve extracted my draggable TabPane from my code and made it available in a bundle who holds only controls. If you have a need for a TabPane with drag support it is as easy as grabbing “org.eclipse.fx.ui.controls_1.0.0.$TIMESTAMP.jar” from our build server (I’ll work on publishing the stuff to maven central)
Once you have the jar added to your project adding the drag support involves only:
HBox h = new HBox(); { Pane pane = DndTabPaneFactory.createDefaultDnDPane( FeedbackType.MARKER, this::setupTb1); HBox.setHgrow(pane, Priority.ALWAYS); h.getChildren().add(pane); } { Pane pane = DndTabPaneFactory.createDefaultDnDPane( FeedbackType.MARKER, this::setupTb2); HBox.setHgrow(pane, Priority.ALWAYS); h.getChildren().add(pane); }
and the 2 methods setupTb1
and setupTb2
look like this:
private void setupTb1(TabPane tb) { { Tab tab = new Tab("T 1.1"); Rectangle r = new Rectangle(100, 100); r.setFill(Color.GREEN); tab.setContent(new BorderPane(r)); tb.getTabs().add(tab); } { Tab tab = new Tab("Tab 1.2"); Rectangle r = new Rectangle(100, 100); r.setFill(Color.RED); tab.setContent(new BorderPane(r)); tb.getTabs().add(tab); } } // ....
Pingback: JavaFX links of the week, August 4 // JavaFX News, Demos and Insight // FX Experience
Hey I improved your implementation by extending from TabPane so this new component can be used in fxml. If you are interested I’ll make a contribution to e(fx)clipse or just give you the source. I have never contributed anything to an eclipse project before, but I’ll try to get into it this week.
My current version of DndTabPane is here: https://github.com/Adrodoc55/MPL/blob/affc01d235fa0d48a7cc54910c6ba501615b4582/ide/src/main/java/de/adrodoc55/minecraft/mpl/ide/fx/DndTabPane.java
Oh and you can see it beeing used in this fxml: https://github.com/Adrodoc55/MPL/blob/affc01d235fa0d48a7cc54910c6ba501615b4582/ide/src/main/resources/mpl-ide.fxml
Hi, I’m unable to find the jar file in the mentioned link.
Can you please upload it again.
Thanks in advance.