Sorry for the lack of explanation.. But yes the two boolean variables are flag variables, and I'm basically setting them outside of that loop.. So I'm trying to figure out how to get those variables updated. I'm basically messing around with threads and
polymorphism. And have a simple question and answer
test the user takes. The test questions are set through a text file and loads the question and answers in to the array based off if it is an image question or text question..
I have this class I have posted which uses an ArrayList of another abstract class (Question) and the array is then filled with two classes (textQuestion) and (ImageQuestion) which extend (Question) class. My other class (Answer), gathers the answer from the user and when the user submits it calls repaint for QuestionPanel (the one currently posted in the forum)..
I have a timer class which implements a timer set to 1000, or seconds. and the user sets the time. When the timer is up this class sets the isTimeUp=true.. When the user sets the time and hit's submit.. it starts the timer, and fires the "go" method inside QuestionPanel (the one currently posted in the forum)
I tie all these classes together in one main class called Quiz.. which sets up the JFrame and inserts each panel, and passes objects of the three panel classes: timer, answer, and questionPanel class...
the changes to the two boolean variables reflect outside of the loop in run() when I test them, just not inside..
So the problem here is when one of the boolean variables in the QuestionPanel is changed it doesn't reflect it inside the run() method.. so I'm trying to figure out the best way to do this.. and understand it more. I will take a look at the link provided and look into the volatile setting too..
Also, if I set the boolean variables to static... shouldn't both threads be accessing the memory address of the variable? this is Why I don't get why the changes are not being reflected..
Thanks!