• 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

Need Help with Timer Class

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a assignment where I have to make a scheduler that when you add a task and a time when the time runs out it should show that scheduled task no matter what your doing.

So I figured out how to do most of it expect one thing.

Say if you add these tasks:

Task: my first task
Time(in seconds): 10

Task: my second task
Time(in seconds): 2

now Task2 will go before Task1(unless your really slow and took 10 seconds to add task2).

Now how I have it right now when the TimerTask happens it takes whatever is in the Task field and displays it.

This of course is not what should be happening since what will happen is when I write "my second task" and add that to the schedule and the 2 seconds go by it will display "my second task" but when "my first task" comes along it won't display "my first task" instead it will display "my second task" or any thing what is written in the Task textbox at that given time.

I have no way of actually storing the tasks. The problem is I don't know how to store the tasks so they go in order.

How would I store them and then make sure the right task gets called up at the right time?

Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic