How to make an if else inside a timer method

Reply

Join Date: Apr 2007
Posts: 40
Reputation: rapperhuj is an unknown quantity at this point 
Solved Threads: 0
rapperhuj rapperhuj is offline Offline
Light Poster

How to make an if else inside a timer method

 
0
  #1
Aug 30th, 2008
Hi..
can we control a timer per second process..? i mean.. if i set a timer.setDelay in 1000 milliseconds.. then in the first second it will out "hi" and the second tick of the timer it will say "hello" and so forth...

can u help me guys how to do it..

im experimenting interfacing with steppermotor..

Thanks guyzz..

ur such a great friend
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: How to make an if else inside a timer method

 
0
  #2
Aug 30th, 2008
Is this the timer in swing or util?

If swing then you just need to place an if-else in the actionPerformed method that the timer is firing.

I'd use a circular (or random) iterator for the actions that you need to take place during calls to the actionPerformed method.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC