I have a Class called GameCharater, which has a "name" stored as a String. I have an instantiation of this object within my Controller class called executing character this executing character is being updated.
When this object updates I would like my UI to update accordingly. For example, a label that shows the player name should change.
Here is an outline of my class.
public class GameController implements Initializable {
private GameCharacter executingCharater;
@FXML
private Label playernamelabel;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
playernamelabel = new Label();
}
How can I dynamical update my UI to a changing object within my controller?
I am aware of the Observer pattern, but I am getting lost trying to figure the standard implementation into a JAVA FX project?