Java tutorial
//package com.java2s; import java.awt.Graphics; public class Main { /** * Fills a circle with the specified bounds. This is used instead of * {@link Graphics#fillRect(int, int, int, int)} due to anti-aliasing * issues. * * @param g the graphics instance to use for painting * @param x the x position for the circle * @param y the y position for the circle * @param width the width of the circle * @param height the height of the circle */ public static void fillCircle(Graphics g, int x, int y, int width, int height) { g.fillRect(x + 1, y + 1, width - 1, height - 1); g.drawLine(x + 1, y, x + width - 1, y); g.drawLine(x + width, y + 1, x + width, y + height - 1); g.drawLine(x + 1, y + height, x + width - 1, y + height); g.drawLine(x, y + 1, x, y + height - 1); } }