0% found this document useful (0 votes)
1K views

Java Practical No.29 PDF

The document contains code for two programs. The first program draws a polygon shape by specifying x and y coordinate points and drawing the polygon. The second program draws a human face by using various oval and arc drawing methods to render features like a head, eyes, nose, mouth.

Uploaded by

Meer Kukreja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Java Practical No.29 PDF

The document contains code for two programs. The first program draws a polygon shape by specifying x and y coordinate points and drawing the polygon. The second program draws a human face by using various oval and arc drawing methods to render features like a head, eyes, nose, mouth.

Uploaded by

Meer Kukreja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

29.1) DEVELOP A PROGRAM TO DRAW A POLYGON.

PROGRAM:

import java.awt.*;

import java.applet.*;

public class polygon extends Applet

public void paint(Graphics g)

int xpoints[] = {30,200,30,200,30};

int ypoints[] = {30,30,200,200,30};

int num = 5;

g.drawPolygon(xpoints,ypoints,num);

/* <applet code = "polygon" width=230 height = 210>

</applet>

*/
OUTPUT:
29.2) DEVELOP AN APPLET FOR DRAWING A HUMAN FACE.

PROGRAM:

import java.awt.*;

import java.applet.*;

public class humanface extends Applet

public void paint(Graphics g)

g.drawOval(40,40,120,150);

g.drawOval(57,75,30,20);

g.drawOval(110,75,30,20);

g.fillOval(68,81,10,10);

g.fillOval(121,81,10,10);

g.drawOval(85,100,30,30);

g.fillArc(60,125,80,40,180,180);

g.drawOval(25,92,15,30);

g.drawOval(160,92,15,30);

/* <applet code = "humanface" width=200 height = 300>

</applet>

*/
OUPUT:

You might also like