Hi there
M developing an game in the form of an applet which has two buttons: Random and Clear
Random button has to generate random numbers in a textfield labelled start.
Generating random numbers is not a problem i have used the code below:
*************** *************** *************** ***
Random rand = new Random();
int i = rand.nextInt();
int n = 10;
i = rand.nextInt(n+ 1);
tfld.setText("" + i);
*************** *************** *************** ****
but the assignment says that to start the game the player clicks on the random button to generate a random number in the tfld textfield.
AND when he clicks again the number should be generated in a different textfleld while the first number is retained.
ANY IDEAS OR HELP WILL BE HIGHLY APPRECIATED
THNKS
Yasin
M developing an game in the form of an applet which has two buttons: Random and Clear
Random button has to generate random numbers in a textfield labelled start.
Generating random numbers is not a problem i have used the code below:
*************** *************** *************** ***
Random rand = new Random();
int i = rand.nextInt();
int n = 10;
i = rand.nextInt(n+ 1);
tfld.setText("" + i);
*************** *************** *************** ****
but the assignment says that to start the game the player clicks on the random button to generate a random number in the tfld textfield.
AND when he clicks again the number should be generated in a different textfleld while the first number is retained.
ANY IDEAS OR HELP WILL BE HIGHLY APPRECIATED
THNKS
Yasin
Comment