我必须显示四个“粉丝”或圆圈勾勒出的圆弧,我设置了扇形/弧形并且看起来像我想要的方式但是我无法弄清楚如何通过圆圈勾勒出它们,任何想法?提前谢谢。
package chap15;
import java.awt.Graphics;
import javax.swing.JPanel;
public class Fans extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int xCenter = getWidth() / 2;
int yCenter = getHeight() / 2;
int radius = (int)(Math.min(getWidth(), getHeight()) * 0.4);
int x = xCenter - radius;
int y = yCenter - radius;
g.fillArc(x, y, 2 * radius, 2 * radius, 0, 30);
g.fillArc(x, y, 2 * radius, 2 * radius, 90, 30);
g.fillArc(x, y, 2 * radius, 2 * radius, 180, 30);
g.fillArc(x, y, 2 * radius, 2 * radius, 270, 30);
}
}