Thanks.
Where are you calling a method to move the circle? I can see calls to paint circles but where do you reset its position?
It was 'hidden' at 135 inside drawCircle - not very logical place to put it, result of moving things around to try and get it to work since I didn't understand what was wrong. I thought if I put it in there the system would 'magically' realize I was moving the circle and call paintComponent or something. Illogical thinking naturally leads to illogical results.
Some of the variable names are poor; in the circle constructor for example you cannot tell that d means diameter. Space out your code. Don't write x+d/2 but x + d / 2.
My first reaction was "Yes sir, sheriff sir." Problem with authority I guess. Then I took a breath and thought Sheriff must have a reason for everything, so try and figure it out (hopefully not an erroneous assumption).
Could be obsessive compulsive and wants everything his way. Or could be it will help me in the long run.
I read through the style guide. Looked around the site at more posted code - gave me a headache trying to look at all that stuff.
Not having a clue how to fix it, I started editing my code to match the style guide. Huh, looks nicer. Easier to read. No headaches. Easier to find stuff. Fewer mistakes.
Thanks sheriff.
Don't use Thread#sleep. Use a Timer instead.
Yeah I read that somewhere, but it was easier to throw the Thread#sleep in there than figure all that stuff out with Timer and ActionListener so I just threw it in (when it was working too fast and everything a blur). I believe was before I used invokeLater too.
Notice that sneaky blue line under Timer linking to tutorial - since I'm waiting on a "real" reply to my message to help I might as well check that out. Time spent puzzling out how to implement ActionListener and then know that means I have to override ActionPerformed using an ActionEvent which has a getActionCommand() method...).
Suddenly it works - my little ball is bouncing around. Using thread#sleep was like unsafe sex leading to bad consequences. Also let me add a Start and Stop button which I wasn't able to do in the past.
Now I got to understand all that thread stuff...
I'll post working code. Thanks. Maybe I should try the Cattle Drive - would it help me learn this stuff better?