Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Count Down Clock  RSS feed

 
James Bunbury
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a quick question that I just can't seem to get my brain to work around:

I want to create a clock that counts down from 10 minutes (nice even number) that I can stop and start at the press of a button. The clock itself is in another file, while the actual code is in a second file. Here is what I have:



The clock is premade and I just have to get it to count downward.

This was a class assignment, however I already handed it in yesterday (much to my frustration) so now I am just shooting for good clear understanding.

Thanks in advance,

Jim~
 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add an ActionListener to the button. In the implemented method actionPerformed(ActionEvent e) you call your pressHere()-method. You could simply use: running = !running;
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!