Please stop me if I'm on the wrong track, but shouldn't the user have to click a button to get it to compare the value they typed in and the number? Every time the user enters a new number, they will have to click a "Compare" button of sorts.
The comparison should be made automatically by pressing "enter", not through a button as the problem says.
Why does it make 5 iterations?
To grant the user the chance to try guessing the number more than one time.
Could you please describe what exactly you're trying to get your program to do?
*The program is supposed to build a GUI interface of two labels, one text field ,and one button.
*The program should generate a random number from 1 to 1000.
*The user role is to guess the random number through a fixed number of trials (which is 5 here).
*One of the labels is for displaying a certain statement that shouldn't be changed. The other has three states :
1- when the guessed number = the random number.
2- when the guessed number > the random number.
3- when the guessed number < the random number.
*At each state the label changes the statement after every trial.
*At state "1" the text editor becomes uneditable.
*The background color should be changed to "red" when the user get near the random number and changed to "blue" when the user get far from the random number.
CONCERNING THE EDIT PART OF YOUR REPLY :
EDIT:
Not going to lie, this is starting to sound a little like homework. But don't get me wrong, I have nothing against helping people with homework, I just won't do it for them. I have also found it's much easier to help somebody when they post the assignment verbatim.
You are right this is a homework, but I don't like to make somebody to do my work. First I keep trying until I reach. Once I find a problem that I can not handle, I try to get help only with
the parts I couldn't solve. I've explained the whole task to make you get the point, but I'm able to solve it except the part I asked about.
For more details :
I've uploaded the code I made on a site by which it can be viewed without downloading and this is the link :
http://rafb.net/p/gqMbip25.html