String operations

Concatenation is the most common string operation. It's called by one property of the String type and takes another property of any type or a constant that will be used as a String, as shown in the following code snippet: 

// chapter3/operations/ConcatBinding.java label.textProperty().bind(    stage.widthProperty().asString() // property one    .concat(" : ")                   // concatting with a string constant    .concat(stage.heightProperty())  // concatting with a property 2);
You don't need to call asString() for a concat() parameter, as it's done by JavaFX.

Note two very important concepts here:

  • Binding operations allow us to chain them one after another (as in the Builder pattern, or in the Java8 Streams API)
  • We've bound one property to the ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.