Grahpics drawArc
用Graphics drawArc 绘制八个同心圆,园与园之间相差八个像素?这个怎么做啊我是新手,希望大家多多帮我!多谢了!
import java.awt.*; import javax.swing.*; public class ShapeTest { public static void main(String[] args) { DrawFrame f = new DrawFrame(); } } class DrawFrame extends JFrame { public DrawFrame() { setTitle("ShapeTest"); setSize(400,400); DrawCircles circles = new DrawCircles(); add(circles); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } } class DrawCircles extends JComponent { public void paintComponent(Graphics g) { int centerX = 200; int centerY = 200; int radius = 50; for (int i=0;i<8;i++) { g.drawArc(centerX - i * 4,centerY - i * 4,radius + i * 8,radius + i * 8,0,360); } } }