I have a FXML file with 2 tabs. In each tab, I have the same list of Text
elements. How to avoid having to duplicate each Text
element?
Here is an extract of my FXML file:
<Tab>
<GridPane>
<columnConstraints>
<ColumnConstraints />
</columnConstraints>
<rowConstraints>
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
</rowConstraints>
<children>
<Text fx:id="text1" GridPane.rowIndex="1" />
<Text fx:id="text2" GridPane.rowIndex="2" />
<Text fx:id="text3" GridPane.rowIndex="3" />
<Text fx:id="text4" GridPane.rowIndex="4" />
</children>
</GridPane>
</Tab>
<Tab>
<GridPane>
<columnConstraints>
<ColumnConstraints />
</columnConstraints>
<rowConstraints>
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
</rowConstraints>
<children>
<Text fx:id="text1" GridPane.rowIndex="1" />
<Text fx:id="text2" GridPane.rowIndex="2" />
<Text fx:id="text3" GridPane.rowIndex="3" />
<Text fx:id="text4" GridPane.rowIndex="4" />
</children>
</GridPane>
</Tab>
If I put the same id in two Text
elements (for example: fx:id="text1"
in the two tabs), I have an error (Duplicate id reference
).