Draw a circle with fan blades inside, Java
I have to display four "fans" or arcs that are outlined by a circle, i have the fanblades/arcs set and looking the way i would like but i cannot figure out how to get them outlined by a circle, any ideas? Thanks in advance.
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 = ge开发者_StackOverflowtWidth() / 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);
}
}
drawArc?
精彩评论