Reputation: 1042
I have the following .fxml file:
<fx:root type="javafx.scene.layout.VBox" xmlns:fx="javafx.com/fxml">
<Pane VBox.vgrow="ALWAYS">
<!-- ... -->
</Pane>
</fx:root>
However, there is an error at VBox.vgrow="ALWAYS"
, since <fx:root ...
is not exactly a VBox. How can I do this in FXML (no Java)?
Edit: The error in my IDE shows "Attribute VBox.vgrow is not allowed here", and the error the Java application gives is "VBox.vgrow is not a valid attribute."
Upvotes: 3
Views: 5265
Reputation: 1042
I had neglected to display all my imports of the .fxml file (which only had javafx.scene.layout.Pane
).
In order for that specific .fxml file to not give an error (see edit), the import javafx.scene.layout.VBox
also had to be added, as VBox.*
cannot be used on any element unless VBox
is imported.
The correct .fxml file is:
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<fx:root type="javafx.scene.layout.VBox" xmlns:fx="javafx.com/fxml">
<Pane VBox.vgrow="ALWAYS">
<!-- ... -->
</Pane>
</fx:root>
Upvotes: 2