Hi guys, im new to the thread posting and am sort of a beginner in java. I programme on Netbeans IDE 6.1
I mainly teach myself, starting from simple codes and then i grow them..
Anyway, i can do many things with java but i somehow can't manage to do something so simple, a Clock.
I have a panel with a label on it and a button.
When the button is pressed the clock/timer should start counting..
Now here comes the problem, my code does what it is supposed to do but doesnt show it to the screen, eg.
for(int regen=0; regen<10; regen++)
{
try{Thread.sleep(1000);} catch(Exception e){}
jLabel1.setText(""+regen);
}
when the button is clicked the above code is run and the GUI seems to freeze for 10 seconds then display jLabel1's text as "9". That is, it skips all the other numbers. i have tried using jLabel.repaint(); but that hasnt worked.
I would really apprecaite it if someone could help me, show me something really simple.
Thank you very much.
