Student Seminar Report & Project Report With Presentation (PPT,PDF,DOC,ZIP)

Full Version: PROGRAM TO DRAW A HUMAN FACE USING APPLET
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
import java.applet.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;

//<applet code=Face width=300 height=300></applet>

public class Face extends Applet
{

    public void init()
       {
    setBackground(Color.red);
    setForeground(Color.green);
       }

    public void paint(Graphics g)
    {
    Font f=new Font("Arial",Font.BOLD,20);
    g.setFont(f);
                   g.drawOval(40,40,120,150);
                   g.drawOval(57,75,30,20);
                   g.drawOval(110,75,30,20);//eye
                   g.fillOval(68, 81,10,10);
                  g.fillOval(121, 81,10,10);
                  g.drawOval(85, 100,30,30);
                  g.drawOval(25, 92,15,30);
                  g.drawOval(160,90,15,30);
                  g.fillArc(60,125,80,40,180,180);
                  g.drawOval(160,90,15,30);
    }
}


OUTPUT
E:\msc3\jiss\java>javac Face.java
E:\msc3\jiss\java>appletviewer Face.java
You can use a java applet for that. Apply the formulas of computer graphics and draw a human face. You can also draw different shapes by using the applet and swing also.