How to implement a JavaFX UI where the language can be changed dynamically

When you are trying to make a multilingual JavaFX application, you have the possibility to give a ResourceBundle to the FXMLLoader when creating the UI from an FXML file. But this fixes the language of the UI when creating it. When you want to change it later, you have to replace your UI with a new loaded version where a different ResourceBundle was passed on loading. In this post I show how to create a UI programmatically, where the language of the UI can be changed dynamically during runtime without rebuilding the UI.