IntelliJ checkstyle indicates that this tag should be removed, as it is not required, as in instead of
<VBox>
<children>
<HBox>
...
</HBox>
<HBox>
...
</HBox>
</children>
</VBox>
you can simply have
<VBox>
<HBox>
...
</HBox>
<HBox>
...
</HBox>
</VBox>
This indeed helps not having bloated code at some times, but I failed to find a good reference on a convention here.
This link mentions that the tag is optional as "the loader will automatically add the sub-elements of the VBox to the container's "children" collection". But that doesn't make it very clear if it would be ok to adopt removing this tag from code or not as a convention?
Also, Scene Builder seems to add these tags to newly created controls, but it doesn't mind if you remove them. It does not re-add them while editing such a modified file.
@DefaultProperty
a property to which child elements will be added or set when an explicit property is not given. see this
Pane
class and all it's subclasses have @DefaultProperty
as children see this , so
Is children tag useful in fxml?
i think no , not really
Should it be removed?
it's depend on your preference
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