Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

keeping time in an applet?

843807Jan 3 2003 — edited Jan 4 2003
hello, i'm a java newbie, and i recently wrote a game called MineSeeker that is like Minesweeper. i turned it into an applet, and that can be found at http://cvchen.digitalrice.com/m_seek.html

anyhow... i was wondering how i would go about creating a "timer" for the applet. one way that i've thought up is something like this:

while(gameStat == GOING)
{
time++;
timePanel.setText(time);
timePanel.paintImmdediately(0, 0, timePanel.getWidth(), timePanel.getHeight());
Thread.sleep(1000);
}

however, this entails multi-threading that that's a bit out of my league as of yet. also, potential problems that i think i foresee would be that the clock in the timePanel would update at different speeds on different people's computers, depending on their computer specs.

help, please... anyone?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2003
Added on Jan 3 2003
3 comments
129 views