Java Utililty Methods Draw Circle

List of utility methods to do Draw Circle

  1. HOME
  2. Java
  3. D
  4. Draw Circle

Description

The list of methods to do Draw Circle are organized into topic(s).

Method

void drawCircle(Graphics g, int centerX, int centerY, int diameter)
Draws a circle with the specified diameter using the given point coordinates as center.
g.drawOval((int) (centerX - diameter / 2), (int) (centerY - diameter / 2), diameter, diameter);
void drawCircle(Graphics g, int x, int y, int diameter)
Draws a circle using the given graphics context, centered at (x,y), having the given diameter.
((Graphics2D) g).addRenderingHints(hints);
g.drawOval(x - diameter / 2, y - diameter / 2, diameter, diameter);
void drawCircle(Graphics2D g2d, int x, int y, int size)
draw Circle
g2d.drawOval(x, y, size, size);
void drawCircle(Graphics2D graphics, double x, double y, double radius)
draw Circle
Shape circle = new Ellipse2D.Double(x - radius, y - radius, radius * 2.0, radius * 2.0);
graphics.draw(circle);
void drawCircle(int x, int y, int radius, Graphics2D graphics2D)
draw Circle
graphics2D.drawOval(x - radius, y - radius, radius * 2, radius * 2);
void drawCircle5(Graphics g, int x, int y)
draw Circle
if (!(g instanceof Graphics2D)) {
 g.drawOval(x - 2, y - 2, 4, 4);
 return;
g.drawLine(x - 2, y - 1, x - 2, y + 1);
g.drawLine(x + 2, y - 1, x + 2, y + 1);
g.drawLine(x - 1, y - 2, x + 1, y - 2);
g.drawLine(x - 1, y + 2, x + 1, y + 2);
...
void drawStatesInCircle(Graphics2D g2d, int x, int y, int width, int height, Color... stateColors)
draw States In Circle
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;
g2d.setColor(Color.BLACK);
g2d.drawOval(x, y, width, height);


AltStyle によって変換されたページ (->オリジナル) /