How to set fx:value using resource bundle?

回眸只為那壹抹淺笑 提交于 2020-01-04 04:28:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!