This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am writing a program for my Java class that is a GUI interface that is to count the seconds and show this on the panel. What I'm having trouble with is getting the seconds. I know how to get the seconds that it is at the time the window is opened then count from there but I want it to start at 1 or 0 every time the program begins. Where so I start to get something like this going?
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: Jan 30, 2002
Now I'm convinced UBB definitely means U Been Bit Candy please ignore the second smiley in the post. I would try to edit it out, but I fear the UBB god is hungry for a sacrifice and would eat the whole thing. [ March 27, 2003: Message edited by: Michael Morris ]
If you have to display seconds as they go by, like a digital clock, see the Timer class. It's built for things like this, but not sure it will have accurate enough resolution to increment a counter every time it ticks. Might have to keep elapsed time. long before = System.currentTimeInMillis(); ... long elapsed = System.currentTimeInMillis()-before;
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi