Dear Forum,
I want to implement a little changing animation, so that each 300 millisecond the jtextField change to the random number (a,b,c,d,e). So I tried this:
Code:
for(int f=1;f<40;f++)
{
int a = 1 + (int) (Math.random() * 6);
int b = 1 + (int) (Math.random() * 6);
int c = 1 + (int) (Math.random() * 6);
int d = 1 + (int) (Math.random() * 6);
int e = 1 + (int) (Math.random() * 6);
jTextField1.setText(a
+ "");
jTextField2.setText(b
+ "");
jTextField3.setText(c
+ "");
jTextField4.setText(d
+ "");
jTextField5.setText(e
+ "");
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println("done");
}
In other words: I want to change the input of jTextField multiple times. After I added the println function, I saw that it runs in the background, but the input doesn't change till f = 40.
This, by the way, is running when a button is pressed.
I am using NetBeans, Windows 7 64-Bit with a very quick processor (it cant be that it doesn't have enough power not to change it quick enough.
I am a beginner, please bare this in mind...
Thanks
PStigerID