And actually, you don't want to call super.paint each time through the loop. You only want to do that once at the very beginning of the method. And you should really be in a paintComponent method,...
Type: Posts; User: KevinWorkman
And actually, you don't want to call super.paint each time through the loop. You only want to do that once at the very beginning of the method. And you should really be in a paintComponent method,...
You are initializing w and h each time, inside the loop. That means they'll start at the same value each iteration. Look at how I initialized the variable (x in my first example) outside the loop, so...
Well let's say I want to draw three circles in a row. All I'd have to do is update the x value as I draw them, right?
Here's some pseudocode:
int x = 20;
for(int i = 0; i < 3; i++){
...
That makes sense. I guess the question is: if you resize the window (make it bigger), do you want to draw the same number of circles, only bigger, or do you want to draw more circles the same size?...
Do you know how many circles you want to draw? You should only need one for loop that loops once for each circle. You just need to update where you're drawing each circle each iteration.
I'd...
Well then post what you've done, no matter how incoherent, and we'll go from there. Don't forget the code (not quote) tags.
What part are you having trouble with?
The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)