The applet would draw ten circles, as before, but they would be smaller circles.
The circles are not side-by-side, and since their left side is touching the left edge of the lines that divide the drawing into 10 regions, the row of circles is shifted left a bit. Here is the modified applet:
import javax.swing.JApplet; import java.awt.*; // Assume that the drawing area is 300 by 150. // Draw ten red circles side-by-side across the drawing area. public class TenSmallCircles extends JApplet { final int width = 300, height = 150; public void paint ( Graphics gr ) { gr.setColor( Color.red ); int diameter = 20; int Y = height/2 - diameter/2; // the top edge of the squares int count = 0 ; while ( count < 10 ) { int X = count*width/10; // the left edge of each square gr.drawOval( X, Y, diameter, diameter ); count = count + 1; } } }
And here is the pretty picture that it draws on your screen:
Here is a picture of the situation with the guide lines drawn in:
It would be nice if the circles were all shifted right.
To make the leftmost circle the same distance from the left edge of the drawing as the rightmost circle is from the right edge, what distance should be circles be shifted?