can i listen to variable change in diffrent class
well as the title states: is it possible for me to listen to a variable change in a diffrent class?
im making a game in wich the GUI.java ( within the view package) has to change the labels of a number of buttons if the gameStatus variable in spel.java( in the model package) changes to false.
i want the model package to be able to run even if the view package aint there. This for Junit testing later on ( its for school btw).
however. i cant find a way to do this. at the moment i made a really ugly solution. whenever i change the variable's value i set a timer to timer.start this timer has set its repeat to false. and im listening to it from the GUI.java.
is there a way if a variable is changed just like the way you listen if the timer is firing?
but then spel.spelStatus.addCheckIfChangedThingyListener();
i spent 1 hour on google finding something like this but no results ( maybe google and i were better friends if he actually knew what i was looking for in this case).
hope if you guys can help me :D thanks in advance