12-16-2011 04:23 AM
Read up on Timer and TimerTask.
Just have a LabelField on your screen that displays the time. To convert the time to hours and minutes look at SimpleDateFormat.
Then the only trick is making sure you run the LabelField update on the Event Thread using invokeLater.
Hopefully that will get you started....
12-19-2011 02:52 AM
thanks Peter for your tips,
I did succesfully make a clock. And when I push 2nd screen , I want to this clock still display and count down with time 1st screen. How can I do that ?
12-19-2011 04:35 AM
Not sure I understand - are you saying youwant the same label to appear on the second screen? If so, the easiest thing to do is ot delete it from the 1st screen and add it to the second screen. You can leave the 'timer' running.
12-19-2011 12:37 PM
I am making a quiz with time limit. In a quiz, each screen have a question and 4 answer. You use next button to go to next question. I want clock run count down and display in all question. Example in the first screen , I display clock with time 60s and it run count down. When I checked answer and click next button to go to next question, clock is 50s. and I want in next screen ( next question), clock count down from 50s , not run from 60s .
Sorry for my bad English, hope you understand me.
12-19-2011 02:45 PM
As noted, the easiest thing to do is to leave the Timer running, and move the 'countdown label from one scren to the next.
I think my preivous post is the answer..