1import java.awt.Graphics;
2
3import javax.swing.JComponent;
4import javax.swing.JFrame;
5
6class MyCanvas extends JComponent {
7
8 public void paint(Graphics g) {
9 g.drawOval (10, 10, 200, 200);
10 }
11}
12
13public class DrawOval {
14 public static void main(String[] a) {
15 JFrame window = new JFrame();
16 window.setBounds(30, 30, 300, 300);
17 window.getContentPane().add(new MyCanvas());
18 window.setVisible(true);
19 }
20}
21