1

I come from Android programming (with Android Studio), and I couldn't avoid asking myself: is there a "strings.xml" equivalent in JavaFX? If not, how to implement it?

I'm using JavaFX (on Intellij IDEA) and I'm designing my application windows on some .fxml files (with SceneBuilder). On some of them there will be showed big blocks of text.

  <Text lineSpacing = "2.0"
        strokeType = "OUTSIDE"
        strokeWidth = "0.0"
        text = "VERY LONG TEXT THAT WILL COMPROMISE FXML FILE READABILITY"
        wrappingWidth = "220.0" />

In the example above I would like to write something like text = "@string/mymessage" instead of the long text.

Robb1
  • 4,587
  • 6
  • 31
  • 60
  • You're looking for "variable binding", which I believe can be only be done from the Java side – OneCricketeer Jun 11 '17 at 12:34
  • Does this help? https://stackoverflow.com/questions/19822717/binding-a-labels-text-property-in-an-fxml-file-to-an-integerproperty-in-a-co – OneCricketeer Jun 11 '17 at 12:37
  • Use a resource bundle: if you want you can provide a properties file for only one languge. Brief description [here](http://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html#resource_resolution), also see https://stackoverflow.com/questions/10143392/javafx-2-and-internationalization. – James_D Jun 11 '17 at 14:35

0 Answers0