wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes getting a clock to update correctly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting a clock to update correctly" Watch "getting a clock to update correctly" New topic
Author

getting a clock to update correctly

D diller
Greenhorn

Joined: Nov 15, 2007
Posts: 29
Hey guys - new here, and to Java programming, and I'm having a bit of difficulty getting a clock program to update properly. As it stands now, the time will update between the time I run the program and click getTime which opens up the window where the clock is displayed. Once it's opened so I can look at the time, it stops updating. When I close it out - but don't recompile or anything like that - the timer restarts.

Below is my code for the two classes I have.

ClockDisplay (This is the one I will have to change)


NumberDisplay (Not really important, but just in case any cross-references are needed...


I think I need to attach a listener to the displayString at the end of my first batch of code. Problem is, I don't know how to do it...

Thanks for any help!
D diller
Greenhorn

Joined: Nov 15, 2007
Posts: 29
Alright, a bit of an update - I put in a while loop that makes the counter to continue even when the program is visible. Now I'm just having a problem with getting the display to show correctly. If I do a System.out.println(displayString); that shows me that the counter is working properly. The displayString(); just doesn't show properly when you execute the getTime(); method.
D diller
Greenhorn

Joined: Nov 15, 2007
Posts: 29
Added in a timer so that it kind of works - see http://www.relaxinlax.com/clock1.JPG to get an idea of what is still not working.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting a clock to update correctly
 
Similar Threads
Please help me this. Im new to this.
ClockDisplay
I would like to have your advice about the way I have designed the application
ClockDisplay again
Create a counter that increments once a second until a given number of seconds is reached