• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timer in java swings

 
Seema Sharma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to know that Timer can be used only in case of any action-event ie., on clicking of any button.
If i am not using any action-event, then how can i use timer.

Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I have to know that Timer can be used only in case of any action-event ie., on clicking of any button.

that statement is wrong, unless it's just a translation hiccup.

Timer uses an actionListener/actionEvent to perform what it has to do, at a given interval.

it does not need to be triggered by the actionEvent of a button, but it can be.
The button's actionListener/actionEvent is different to that of the timer

bookmark this page, then scroll down to the 'How to use Timers' link

http://java.sun.com/docs/books/tutorial/uiswing/TOC.html
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Seema Sharma:
Hi,
I have to know that Timer can be used only in case of any action-event ie., on clicking of any button.
If i am not using any action-event, then how can i use timer.

how about
That'll get your ActionEvent humming. For better details, check out Michael's excellent link.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!