Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Java Timer
Meet Gaurav
Ranch Hand
Posts: 492
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi
I need to start the timer from zero. Some please assist me
The new Date is starting it from System Date.
timer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { s = timef.format(new Date()); tf.setFont(new Font("Arial", Font.BOLD, 25)); tf.setText(s); } }); timer.start();
Rob Spoor
Sheriff
Posts: 22783
131
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Check out the methods in
javax.swing.Timer
. There are two that can set two different delays. Call one of those.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
doruk turkoglu
Greenhorn
Posts: 4
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i really cant get question fully but if you want to display a date-time thing in panel or whatelse and want to start it from 0 (is it 01.01.2000 00:00)
you should
set time of your date with Date constructor
Campbell Ritchie
Marshal
Posts: 79179
377
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Check the API, but I think "0" means 1st January 1970.
Meet Gaurav
Ranch Hand
Posts: 492
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This helps me.. thanks for all your reply
This will starts with 1 hr and ends with 0(I mean after 1 Hr). Reverse timer
int count = -16200; timer = new Timer(1000, new ActionListener(){ public void actionPerformed(ActionEvent e) { // 00 TIME = -19800 if(count == -19800) { timer.stop(); } s = timef.format(count-- * 1000); tf.setFont(new Font("Arial", Font.BOLD, 25)); tf.setText(s); } }); timer.start();
Hey cool! They got a blimp! But I have a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Duplicate Timers in JBOSS
controlling ejbTimeout EJB 2.1
Timer & TimerTask - Name of Timer Object
ejb as abstract ?
Need to restart timer with different time
More...