Java Draw Circle drawStatesInCircle(Graphics2D g2d, int x, int y, int width, int height, Color... stateColors)

Here you can find the source of drawStatesInCircle(Graphics2D g2d, int x, int y, int width, int height, Color... stateColors)

Description

draw States In Circle

License

Open Source License

Declaration

public static void drawStatesInCircle(Graphics2D g2d, int x, int y, int width, int height,
            Color... stateColors) 

Method Source Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static void drawStatesInCircle(Graphics2D g2d, int x, int y, int width, int height,
            Color... stateColors) {
        int states = stateColors.length;
        if (states > 0) {
            int startAngle = 0, arcAngle = 360 / states;
            for (Color stateColor : stateColors) {
                g2d.setColor(stateColor);
                g2d.fillArc(x, y, width, height, startAngle, arcAngle);
                startAngle = startAngle + arcAngle;
            }//from   w ww.ja va 2s .  com
        }
        g2d.setColor(Color.BLACK);
        g2d.drawOval(x, y, width, height);
    }
}

Related

  1. drawCircle(Graphics g, int x, int y, int diameter)
  2. drawCircle(Graphics2D g2d, int x, int y, int size)
  3. drawCircle(Graphics2D graphics, double x, double y, double radius)
  4. drawCircle(int x, int y, int radius, Graphics2D graphics2D)
  5. drawCircle5(Graphics g, int x, int y)