lOkay so I have gotten stumped on this one...
What i'm trying to achieve is to generate a series of numbers between 0-9. After The generation of the numbers, i want them to be typed into a text field on the screen. I have gotten all the essentials working except the changing a random number into a key code. Currently when i go to convert it to a key code, it turns into 0.
Here is my code:
public void random() {
int rand = new Random().nextInt(10);
System.out.println(""+rand);
convert();
}
public void convert() {
switch (rand) {
case 0:
rand = KeyEvent.VK_0;
System.out.println(""+0);
break;
case 1:
rand = KeyEvent.VK_1;
System.out.println(""+1);
break;
case 2:
rand = KeyEvent.VK_2;
System.out.println(""+2);
break;
case 3:
rand = KeyEvent.VK_3;
System.out.println(""+3);
break;
case 4:
rand = KeyEvent.VK_4;
System.out.println(""+4);
break;
case 5:
rand = KeyEvent.VK_5;
System.out.println(""+5);
break;
case 6:
rand = KeyEvent.VK_6;
System.out.println(""+6);
break;
case 7:
rand = KeyEvent.VK_7;
System.out.println(""+7);
break;
case 8:
rand = KeyEvent.VK_8;
System.out.println(""+8);
break;
case 9:
rand = KeyEvent.VK_9;
System.out.println(""+9);
break;
}
}
The out put is this:
5
0
What it should be:
5
53
Any suggestions/solutions?
Thanks!!