简体   繁体   中英

How to set fx:value using resource bundle?

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM