face.java
import java.applet.*;
import java.awt.*;
/* <applet code = "face.class" width = 300 height = 300> </applet> */
public class face extends Applet
{
public void paint(Graphics g)
{
/*face*/
g.drawOval(50,50,300,300);
g.setColor(Color.yellow);
g.fillOval(51,51,298,298);
/*Eyes*/
g.setColor(Color.black);
g.fillOval(110,130,50,50);
g.fillOval(240,130,50,50);
/*Smile*/
g.setColor(Color.red);
g.drawArc(120,240,160,80,180,180);
}
}
face.html
<HTML>
<BODY>
<TITLE>Smiley Face using Applet</TITLE>
<APPLET CODE="face.class" width=400 height=400>
</APPLET CODE>
</BODY>
</HTML>
0 Comments