Java applet program to make face

      No Comments on Java applet program to make face

Applet program to make face

Java applet program to make face.

  • drawOwal() method is used to draw circle.
  • g.setColor() is used for selecting a color. eg. g.setColor(Color.red) will set a color to red.
  • g.fillOval() is used to fill the color which is selected by g.setColor().

scanfcode.java

import java.awt.*;
import java.applet.*;
public class scanfcode extends Applet
{
	
  public void paint(Graphics g)
  {
	 g.drawOval(30,0,200,200);
	 	  g.drawOval(25,80,6,20); 
		  g.drawOval(230,80,6,20); 
	  g.setColor(Color.red);
	  g.fillOval(80,40,25,25);
	  g.fillOval(160,40,25,25);
	  g.setColor(Color.green);
	  g.fillOval(120,90,25,25);
	  g.fillArc(91,125,80,40,180,180);
	    }
 }

scanfcode.html

<html>
<head>
<title>
<p>First applet program</p>
</title>
</head>
<body>
<applet code="scanfcode.class" width="350" height="350">
</applet>
</body>
</html>

Command

applet program to make face

OUTPUT

applet program to make face


Comment below if you are facing any problem.


Also read

Java applet program to draw circle
Java applet program to draw line and rectangle
Java program to display sum of two input numbers in applet


Summary
Java applet program to make face
Article Name
Java applet program to make face
Description
This program illustrate the concept of applet program to make face. drawOwal() method is used to draw face. g.setColor() is used for selecting a color.
Author
Publisher Name
Scanfcode
Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *