I think there are several math problems.
Type: Posts; User: Norm
I think there are several math problems.
I don't see ANY debugging printlns in your code. You need to add some to show what is happening.
Add them at all the places decisions are made and values are changed that effect the problem you are...
You need to do some debugging to see what the code is doing. Add some printlns to show the execution flow and the values of variables as they change.
Where? I don't see where it is called from anywhere except the paint method.
Several problems I see:
Passing a graphics with a setter method vs only to the draw methods.
Starting a new thread every time paint is called.
The paint method should be short and simple:
...
You still have some code in the paint() method that should be in the constructor. adding key listeners.
The Graphics object should be passed to the drawing methods directly, not via a setter.
...
One comment so far, you should pass the Graphics object that the paint method receives to the drawing method each time the paint method is called. Don't save an old version and reuse it.
Don't...
Please post your code here in the thread. Be sure to wrap it in code tags. See: BB Code List - Java Programming Forums or press Go Advanced and use the # icon