问题
In java fx it is possible to use i18n labels for components using the %key
notation.
For example -
<Label layoutX="151.0" layoutY="14.0" text="%windowTitle">
<font>
<Font size="22.0" />
</font>
</Label>
Is it possible to use i18n for component values?
The following code does not work -
<ChoiceBox layoutX="140.0" layoutY="67.0" prefWidth="164.0">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="%listValue1" />
<String fx:value="%listValue2" />
<String fx:value="%listValue3" />
<String fx:value="%listValue4" />
</FXCollections>
</items>
</ChoiceBox>
回答1:
AFAIK FXML doesn't support resource ids in meta-tags like fx:value
. See http://javafx-jira.kenai.com/browse/DTL-3699 for example.
You may want to file an enhancement request for that at http://javafx-jira.kenai.com
来源:https://stackoverflow.com/questions/12153446/how-to-set-fxvalue-using-resource-bundle