Quick Java question..

SenorDingDong

Newbie
Joined
May 18, 2003
Messages
382
Reaction score
0
Ok i have some little assignment to do In java to help learn GUI.

Anyway theres a command button and 4 labels. When u click the command button once one label goes red, hit it again, next one goes red (first still is red), hit it again, third goes red until there all red. Once there all red u hit it they all go to black then it starts over again....

Now i know how to do all the code, only thing is I can't think of the logic to do it... Can u check to see if the buttons been pressed more then once?
 
You could just use a counter and increment it by one each time the user clicks on the button. Then you could have an If statement so that when the counter reaches 4, reset the counter to 0 and reset the colors for the labels to black.
 
yea thats exactly what i ended up doing. I was thinking something more complex and didn't even think of doing something as simple as that.
 
Back
Top