• 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

CountDown Timer

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to implement a countdown timer. Can anyone give me some assistance. Thanks!!
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following link may help

SourceForge Countdown Timers
 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
depends on what you want...

umm...

you can use java.util.Timer

or you can just create a thread




Justin
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Justin Fox:
...or you can just create a thread...


If you're just calling sleep, there's no need to create a new thread object, because the sleep method is static.

Marcus: This sounds like a homework assignment. Can you tell us more about what the requirements are, what you've tried, and where exactly you're stuck? I'm sure we can help you, but we need more information.
 
Marcus Senna
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, actually it is part of my final year university project.
I am creating an application which allows users to simulate certain communications protocols. This application would allow users to configure networks using network components such as routers and hosts by dragging and dropping images of them onto a configuration area and setting up links between them. I would like to achieve the effect of a propagation delay when data is sent along links between the nodes. I tried using the java.util.Timer class along with the java.util.TimerTask class, but I am getting problems because of thread synchronization issues(i concluded this, I could be wrong).
I found a class online, timer_engine, which is a virtual timer and right now i am trying to incorporate it into my system. Below is a thread I was trying to write to do the propagation delay.

Bascially, i have a class called Link, which has a vector called Data which stores the DataUnit objects being sent and routed by Host and Routerobjects. The above thread is first checking to see whether the vector is empty. That is the problem i am having; although i am doing this check before I do anything to the vector, i am still getting this exception: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
I don't know if i have explained myself well enough, so i will stop here and wait for your feedback. Thanks!!!
 
Marcus Senna
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
timer_engine class I found online:
 
Marcus Senna
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I modified the timer_engine class a bit, to suit my application
 
reply
    Bookmark Topic Watch Topic
  • New Topic