I have tried using the method drawOval with equal height and width but as the diameter increases the circle becomes worse looking. What can I do to have a decent looking cir
Two things that may help:
Graphics2D.draw(Shape)
with an instance of java.awt.geom.Ellipse2D
instead of Graphics.drawOval
Graphics2D.setRenderingHint
to enable antialiasingExample
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Shape theCircle = new Ellipse2D.Double(centerX - radius, centerY - radius, 2.0 * radius, 2.0 * radius);
g2d.draw(theCircle);
}
See Josef's answer for an example of setRenderingHint