You're forgetting your basic arithmetic
Division is applied before subtraction, so you're doing width * (counter / 8) which is always zero (counter being an int). You want (width * counter) / 8. Also, here you have an initialiser, a test, and an incrementor, which is what for loops are for, although to optimise we can put the incrementation and the addition steps together:
Code:
int width = getWidth(), height = getHeight();
for(int i = 0; i < 8; )
g.drawOval((width * i) / 8, 0, (width * (++i)) / 8, height / 8);
Also note that because you started from zero, if you want to execute the loop eight times you must loop until i < 8 or i <= 7. i < 7 will only execute seven times.
Bookmarks