Program for Design a Smiley face using Java Applet
Program
import java.applet.*;
import java.awt.*;
import java.awt.*;
public class smileyface extends Applet
{
public void init()
{
setForeground(Color.red);
setBackground(Color.green);
}
public void paint(Graphics g)
{
g.setColor(Color.yellow);
g.fillOval(400,250,400,400);
g.setColor(Color.black);
g.fillOval(500,350,40,90);
g.setColor(Color.black);
g.fillOval(640,350,40,90);
g.setColor(Color.red);
g.fillArc(471,460,260,130,0,-180);
g.setColor(Color.black);
g.drawArc(471,460,259,130,0,-180);
g.setColor(Color.white);
g.fillRect(471,510,260,20);
g.fillRect(550,550,90,15);
}
}
/**
<html>
<body>
<applet code="smileyface.class" width="1300" height="900">
</applet>
</body>
</html>
**/
Output :
0 Response to "smiley in Applet"
Post a Comment