import java.awt.*;
import java.applet.*;
import java.awt.event.*;
class Ovalcanvas extends Canvas
{
Ovalcanvas()
{ setSize(200,200);
setBackground(Color.cyan);
}
public void paint(Graphics g)
{ g.drawOval(50,50,2*50,2*50);
}
}
public class Example6_3 extends Frame
{ Ovalcanvas canvas;
private class WindowCloser extends WindowAdapter
{ public void windowClosing(WindowEvent we)
{System.exit(0);}
}
Example6_3()
{
super("画布");
setSize(500,300);
show();
canvas=new Ovalcanvas();
setLayout(new FlowLayout());
add(canvas);
validate();
addWindowListener(new WindowCloser());
}
public static void main(String args[])
{
new Example6_3();
}
}