My assignment is to draw 8 concentric circles 10 pixels apart using drawArc. The problem is that it comes out looking more like a funnel. What am I doing wrong? My code is below:
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
public class ConcentricCircles extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.BLUE);
int x1 = 10;
int y1 = 10;
int w = 100;
int h = 100;
for (int i = 1; i <= 8; i++) {
g.drawArc(x1, y1, w, h, 0, 360);
System.out.printf("x1=%d, y1=%d, w=%d, h=%d\n", x1, y1, w, h);
x1 += 10;
y1 += 10;
w -= 10;
h -= 10;
}
}
}