Results 1 to 2 of 2
Thread: for More TIMER control...
- 09-05-2010, 04:52 PM #1Member
- Join Date
- Feb 2010
- Rep Power
for More TIMER control...
in the list of methods of the javax.swing Timer Class :
Java Platform SE 7 b97
i expect the existence of the following 2 methods (or like) :
1) void setRepeats(int SpecificTimes)
This method tells the timer to send exactlly a "Specific Number" action events to its listeners,
So the action will be executed as many times as the user needs.
2) int getDoneTimes()
When called, This method returns the number of times the Action is done (till the moment)...
Really it is nice to get such service from such Methods (or an equivalent code doing the job)
in order to control more and more the work of Timer class...
Is there an equivalent ??
(May be it exists but i don't know?!:confused:)
Thanks for any help
It's easy to give your Timer this functionality. One way would be to create a counter variable that is advanced each time the actionPerformed is called, would give this counter a public getter() method and also have an if block in the actionPerformed that stops the timer once count > MAX_COUNT. Note that the Timer object itself can be accessed from the actionPerformed via the ActionEvent's getSource() method.
- By firecat318 in forum New To JavaReplies: 6Last Post: 05-31-2010, 02:38 AM
- By mrjunsy in forum Advanced JavaReplies: 0Last Post: 08-22-2008, 04:09 PM
- By mrjunsy in forum New To JavaReplies: 0Last Post: 08-04-2008, 06:47 PM
- By thebillybobjr in forum SWT / JFaceReplies: 0Last Post: 05-15-2008, 04:52 PM
- By Java Tip in forum java.utilReplies: 0Last Post: 04-04-2008, 02:46 PM