I'm using JavaFX Scene Builder 2.0. version and I would like to import a FXML file under TabPane controller. My idea is that I will have one kind of container FXML file with TabPane and separate FXML files for things that will come inside of tabs. When I try to import FXML file where I have things that I would like to add under one tab, Scene Builder gives error message "Failed to import TabContents.fxml under TabPane". Why it is not possible to import anything under the TabPane? If I import same file directly under root StackPane everything works.
StackPane to the content area of your Tab, ensuring that it occupies 100% of the area.StackPane you just added.TabContents.fxml. It should automatically be added to the created StackPane and should display as desired.Also, to answer your additional question, importing it directly into the TabPane will render it as a Graphic rather than a Node.
EDIT: While the below works, it is best to add some sort of layout pane (like an AnchorPane) to each tab in your TabPane, select the AnchorPane pane in the hierarchy view on the left and then import your other fxml document into that, as opposed to importing directly into a TabPane (Perhaps if the root node of the document is a Tab it would work?).
Looks like a bug, for now:
And voila, working as intended!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With