I guess there should be some event for this, but didn’t find any. The code I have now is
stage.titleProperty().bind(tabPane.getSelectionModel().getSelectedItem().textProperty());
But it doesn’t change the title dynamically, what’s the right solution?
Puce’s explanation is correct. Here is a change listener example.
Use the above code instead of the sample code in your question.