943,918 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 829
  • Java RSS
Aug 30th, 2008
0

How to make an if else inside a timer method

Expand Post »
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
Reputation Points: 7
Solved Threads: 0
Light Poster
rapperhuj is offline Offline
40 posts
since Apr 2007
Aug 30th, 2008
0

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

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.
Reputation Points: 392
Solved Threads: 108
Posting Shark
Alex Edwards is offline Offline
971 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: problem with multiple classes
Next Thread in Java Forum Timeline: hibernate.hbm.xml





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC