Couldn't find any examples on this. How do I define constants in an FXML file?
For example (where CONTENT_SPACING
is the constant I want to create):
<VBox fx:controller="myapp.Controller" xmlns:fx="http://javafx.com/fxml" alignment="center" spacing="20">
<fx:define>
<Double fx:id="CONTENT_SPACING" fx:value="200"/>
</fx:define>
<VBox fx:id="content" spacing="$CONTENT_SPACING">
<!-- My window contents would go here -->
</VBox>
</VBox>
My code would benefit in readability if this was possible. Thanks!
Well, this is a bit embarrassing. It was valid FXML all along, but my IDE (IntelliJ IDEA) keeps telling me it's not. The code itself runs fine.
I'll go file a bug report.
Edit: Bug is fixed.