|
Drawing a Cartoon
import java.awt.*;
publie class Face extends Frame
{
public Face()
{
setTitle ("Face");
setBackground(new Color(128,255,255));
}
public boolean handleEvent(Event e)
{
if (e.id == Event.WIN~OW_DESTROY)
{
System.exit(0);
return super.handleEvent(e);
}
public void paint(Graphics g)
{
g.drawOval(200,150,200,200);
g.drawOval(240,200,20,20);
g.drawOval(335,200,20,20);
g.drawLine(300,210,280,270);
g.drawLine(28G,270,310,270);
g.drawArc(250,250,100,60,180,180);
g.drawOval(395,200,28,28);
g.drawOval(179,200,28,28);
public static void main(String arg[])
{
Face l;
l = new Face();
l.resize(600,600);
l.show();
}
}
Output
:
This code will show you how you can draw a cartoon.
|