File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "update" Watch "update" New topic
Author

update

Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
Hi,
Help me with this program my friends.
This is a a clock program.
It has a Button who's objective is to add an hour to the time.
I am using two threads.

One for the original time(when the program starts), and another for the hour that is going to be added.
the startClock2() calls the new thread and adds an hour, but when i press the button, nothing happens.
What can I do so the Button adds the hour?
thanks
This is the code.

Clock2.java
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
Have you really used the Thread.stop() method?

Don't. Read this. Get rid of any references to stop and the other deprecated methods of Thread.
Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
I understand the deprecated Thread.stop() method issue.
But is that really the problem?
Because i tried that with another example with the stop() method, and it worked great.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
No, "stop()" isn't your problem at the moment. But you will get major problems in future jobs if you use methods deprecated that way.

You are getting as far as the updateClock2 method. You are going to have to follow the thread of execution through with a debugger, or by putting lines in which read rather like this:-And keep following until you find which time you are actually displaying.
Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
Originally posted by Campbell Ritchie:
No, "stop()" isn't your problem at the moment. But you will get major problems in future jobs if you use methods deprecated that way.

You are getting as far as the updateClock2 method. You are going to have to follow the thread of execution through with a debugger, or by putting lines in which read rather like this:-And keep following until you find which time you are actually displaying.


I don't understand what you are telling me.
Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
marc weber, please help me with this.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
How are you supposed to reassign the time after clicking the button. You have your counter variable, which is incremented when you click the button. Where does that go next?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: update