import java.awt.*; import java.awt.geom.*; import javax.swing.*; public class JCircle extends JPanel { private Ellipse2D.Double circle = new Ellipse2D.Double(10, 10, 30, 30); public void paintComponent(Graphics g) { clear(g); Graphics2D g2d = (Graphics2D)g; g2d.setStroke(new BasicStroke(3)); g2d.draw(circle); } // super.paintComponent clears offscreen pixmap, // since we're using double buffering by default. protected void clear(Graphics g) { super.paintComponent(g); } protected Ellipse2D.Double getCircle() { return(circle); } public static void main(String[] args) { WindowUtilities.openInJFrame(new JCircle(), 380, 400); } }